-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added option to define custom keys for stateful links.
- Loading branch information
Showing
19 changed files
with
154 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
...edis/src/jvmMain/kotlin/eu/vendeli/ktgram/botctx/redis/chain/BaseRedisLinkStateManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
package eu.vendeli.ktgram.botctx.redis.chain | ||
|
||
import eu.vendeli.tgbot.types.internal.IdLong | ||
import eu.vendeli.tgbot.types.internal.chain.KeySelector | ||
import eu.vendeli.tgbot.types.internal.chain.StatefulLink | ||
import kotlinx.serialization.json.Json | ||
import kotlin.reflect.KClass | ||
|
||
open class BaseRedisLinkStateManager<L : StatefulLink<T>, T : Any>( | ||
open class BaseRedisLinkStateManager<L : StatefulLink<IdLong, T>, T : Any>( | ||
url: String = "redis://localhost", | ||
storageType: KClass<T>, | ||
linkRef: KClass<L>, | ||
serializer: Json = Json, | ||
) : RedisLinkStateManager<L, T>(url, storageType, linkRef, serializer) | ||
stateKeySelector: KeySelector<IdLong>, | ||
) : RedisLinkStateManager<L, T>(url, storageType, linkRef, serializer, stateKeySelector) |
8 changes: 5 additions & 3 deletions
8
...tx-redis/src/jvmMain/kotlin/eu/vendeli/ktgram/botctx/redis/chain/RedisBaseStatefulLink.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
package eu.vendeli.ktgram.botctx.redis.chain | ||
|
||
import eu.vendeli.tgbot.types.internal.IdLong | ||
import eu.vendeli.tgbot.types.internal.chain.LinkStateManager | ||
import eu.vendeli.tgbot.types.internal.chain.StatefulLink | ||
import eu.vendeli.tgbot.types.internal.userOrNull | ||
import kotlinx.serialization.json.Json | ||
import kotlin.reflect.KClass | ||
|
||
abstract class RedisBaseStatefulLink<L : StatefulLink<String>>( | ||
abstract class RedisBaseStatefulLink<L : StatefulLink<IdLong, String>>( | ||
url: String = "redis://localhost", | ||
linkRef: KClass<L>, | ||
serializer: Json, | ||
) : StatefulLink<String>() { | ||
override val state: LinkStateManager<String> = BaseRedisLinkStateManager(url, String::class, linkRef, serializer) | ||
) : StatefulLink<IdLong, String>() { | ||
override val state: LinkStateManager<IdLong, String> = BaseRedisLinkStateManager(url, String::class, linkRef, serializer) { it.userOrNull } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.