-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
code corrections and add filter in handler
- Loading branch information
Данила Беляков
authored and
Данила Беляков
committed
Nov 19, 2024
1 parent
4ce16a2
commit 9b51a85
Showing
63 changed files
with
769 additions
and
312 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
kotlin version: 2.0.21 | ||
error message: The daemon has terminated unexpectedly on startup attempt #1 with error code: 0. The daemon process output: | ||
1. Kotlin compile daemon is ready | ||
|
19 changes: 4 additions & 15 deletions
19
alice-ktx/src/main/kotlin/com/github/alice/ktx/Dispatch.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
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
2 changes: 1 addition & 1 deletion
2
alice-ktx/src/main/kotlin/com/github/alice/ktx/api/dialog/yandex/models/image/Image.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
2 changes: 1 addition & 1 deletion
2
alice-ktx/src/main/kotlin/com/github/alice/ktx/api/dialog/yandex/models/sounds/Sound.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
9 changes: 9 additions & 0 deletions
9
alice-ktx/src/main/kotlin/com/github/alice/ktx/common/Annotations.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.github.alice.ktx.common | ||
|
||
@DslMarker | ||
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPEALIAS, AnnotationTarget.TYPE, AnnotationTarget.FUNCTION) | ||
annotation class AliceDsl | ||
|
||
@DslMarker | ||
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPEALIAS, AnnotationTarget.TYPE, AnnotationTarget.FUNCTION) | ||
annotation class AliceResponseDsl |
57 changes: 57 additions & 0 deletions
57
alice-ktx/src/main/kotlin/com/github/alice/ktx/common/Redis.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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.github.alice.ktx.common | ||
|
||
import io.lettuce.core.RedisClient | ||
import io.lettuce.core.api.StatefulRedisConnection | ||
|
||
/** | ||
* Формирует строку URI для подключения к Redis на основе заданных параметров. | ||
* | ||
* @param host Хост Redis-сервера. По умолчанию "localhost". | ||
* @param port Порт Redis-сервера. По умолчанию 6379. | ||
* @param username Необязательное имя пользователя для аутентификации. Если null, имя пользователя не указывается. | ||
* @param password Необязательный пароль для аутентификации. Если null, пароль не указывается. | ||
* @return Строка URI для подключения к Redis. | ||
* | ||
* Примеры: | ||
* - Если указаны только `host` и `port`: "redis://localhost:6379" | ||
* - Если указан `password` без `username`: "redis://:password@localhost:6379" | ||
* - Если указаны и `username`, и `password`: "redis://username:password@localhost:6379" | ||
*/ | ||
fun redisUri( | ||
host: String = "localhost", | ||
port: Int = 6379, | ||
username: String? = null, | ||
password: String? = null | ||
): String { | ||
return if (password != null) { | ||
if (username != null) { | ||
"redis://$username:$password@$host:$port" | ||
} else { | ||
"redis://:$password@$host:$port" | ||
} | ||
} else { | ||
"redis://$host:$port" | ||
} | ||
} | ||
|
||
/** | ||
* Устанавливает соединение с Redis-сервером, используя параметры подключения. | ||
* | ||
* Этот метод создает подключение к Redis с использованием клиента, полученного | ||
* из URI, сформированного на основе переданных параметров. | ||
* | ||
* @param host Хост Redis-сервера. По умолчанию "localhost". | ||
* @param port Порт Redis-сервера. По умолчанию 6379. | ||
* @param username Необязательное имя пользователя для аутентификации. Если null, имя пользователя не указывается. | ||
* @param password Необязательный пароль для аутентификации. Если null, пароль не указывается. | ||
* @return Объект StatefulRedisConnection, представляющий подключение к Redis. | ||
*/ | ||
fun connectToRedis( | ||
host: String = "localhost", | ||
port: Int = 6379, | ||
username: String? = null, | ||
password: String? = null | ||
): StatefulRedisConnection<String, String> { | ||
val redisClient = RedisClient.create(redisUri(host, port, username, password)) | ||
return redisClient.connect() | ||
} |
2 changes: 1 addition & 1 deletion
2
...ice/ktx/common/LocalDateTimeSerializer.kt → ...on/serializers/LocalDateTimeSerializer.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
2 changes: 1 addition & 1 deletion
2
...om/github/alice/ktx/context/FSMContext.kt → ...in/com/github/alice/ktx/fsm/FSMContext.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
2 changes: 1 addition & 1 deletion
2
...ub/alice/ktx/context/MutableFSMContext.kt → ...github/alice/ktx/fsm/MutableFSMContext.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
2 changes: 1 addition & 1 deletion
2
...b/alice/ktx/context/ReadOnlyFSMContext.kt → ...ithub/alice/ktx/fsm/ReadOnlyFSMContext.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
4 changes: 2 additions & 2 deletions
4
.../alice/ktx/context/impl/BaseFSMContext.kt → ...thub/alice/ktx/fsm/impl/BaseFSMContext.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
Oops, something went wrong.