Skip to content

jedis.redissed extension getter cannot be resolved #2

@ahmaducg

Description

@ahmaducg

In Kotlin 1.4.10, the IDE cannot resolve jedis.redissed getter, even if I implicitly add the import.

I simply added the dependencies (Redissed and Jedis) and copied the code from the READ ME file in this repository

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import br.com.devsrsouza.redissed.RedisObject
import br.com.devsrsouza.redissed.RedissedCommands
import redis.clients.jedis.Jedis

class MainActivity : AppCompatActivity(R.layout.activity_main) {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val jedis = Jedis("localhost", 6379)
        jedis.connect()

        val commands = jedis.redissed

        val my = MyObject("my:db:obj", commands)

        my.hello = "Hello" // setting "Hello" to my:db:obj:hello
        my.hi // getting my:db:obj:hi from Redis if not exist return default "Hi"

        my.hello = null // removing data from my:db:obj:hello

        my.other.something = "Anything" // setting "Anything" to my:db:obj:other:something
        my.other.points = 10 // setting 10 to my:db:obj:other:points
    }

    class MyObject(database: String, commands: RedissedCommands) : RedisObject(database, commands) {
        var hello: String? by string()
        var hi: String by string("Hi")

        val other: OtherObject by obj { OtherObject(it, commands) }
    }

    class OtherObject(database: String, commands: RedissedCommands) : RedisObject(database, commands) {
        var something by string()

        var points by int(0)
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions