laniakea v0.7
This commit is contained in:
@@ -4,3 +4,5 @@ PREFIXES=/;!
|
||||
DEBUG=true
|
||||
USE_REQ_LOG=true
|
||||
WRITE_TO_FILE=false
|
||||
USE_TEST_SERVER=true
|
||||
API_URL=http://127.0.0.1:8081
|
||||
@@ -69,18 +69,18 @@ func (rep UserRepository) GetOrCreate(tgId int, name string) (*User, error) {
|
||||
}
|
||||
|
||||
func (rep UserRepository) Create(id int, name string) (*User, error) {
|
||||
user := User{}
|
||||
user := new(User)
|
||||
err := rep.db.Get(user, "INSERT INTO users (id, name) VALUES ($1, $2) RETURNING *;", id, name)
|
||||
return &user, err
|
||||
return user, err
|
||||
}
|
||||
|
||||
func (rep UserRepository) GetById(telegramId int) (*User, error) {
|
||||
user := User{}
|
||||
err := rep.db.Get(&user, "SELECT * FROM users WHERE id=$1;", telegramId)
|
||||
user := new(User)
|
||||
err := rep.db.Get(user, "SELECT * FROM users WHERE id=$1;", telegramId)
|
||||
if err != nil {
|
||||
return &user, err
|
||||
return user, err
|
||||
}
|
||||
return rep.GetJoins(&user)
|
||||
return rep.GetJoins(user)
|
||||
}
|
||||
|
||||
func (rep UserRepository) GetJoins(user *User) (*User, error) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:18.1-alpine
|
||||
image: postgres:18.2-alpine3.23
|
||||
networks:
|
||||
- bot
|
||||
ports:
|
||||
@@ -19,7 +19,7 @@ services:
|
||||
- ./scripts/postgres:/docker-entrypoint-initdb.d
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
mongo:
|
||||
image: mongo:noble
|
||||
image: mongo:8.2.5-noble
|
||||
networks:
|
||||
- bot
|
||||
ports:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: "kurumibot"
|
||||
name: "ymbot"
|
||||
include:
|
||||
- db.docker-compose.yml
|
||||
services:
|
||||
@@ -20,7 +20,6 @@ services:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
restart: true
|
||||
|
||||
networks:
|
||||
bot:
|
||||
driver: bridge
|
||||
4
go.mod
4
go.mod
@@ -4,7 +4,7 @@ go 1.26.0
|
||||
|
||||
require (
|
||||
git.nix13.pw/scuroneko/extypes v1.2.0
|
||||
git.nix13.pw/scuroneko/laniakea v0.6.2
|
||||
git.nix13.pw/scuroneko/laniakea v0.7.1
|
||||
git.nix13.pw/scuroneko/slog v1.0.2
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/joho/godotenv v1.5.1
|
||||
@@ -15,7 +15,7 @@ require (
|
||||
go.mongodb.org/mongo-driver/v2 v2.5.0
|
||||
)
|
||||
|
||||
//replace git.nix13.pw/scuroneko/laniakea v0.6.2 => ./laniakea
|
||||
//replace git.nix13.pw/scuroneko/laniakea v0.7.0 => ./laniakea
|
||||
//replace git.nix13.pw/scuroneko/extypes v1.2.0 => ../go-extypes
|
||||
//replace git.nix13.pw/scuroneko/slog v1.0.2 => ../slog
|
||||
|
||||
|
||||
4
go.sum
4
go.sum
@@ -2,8 +2,8 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
git.nix13.pw/scuroneko/extypes v1.2.0 h1:2n2hD6KsMAted+6MGhAyeWyli2Qzc9G2y+pQNB7C1dM=
|
||||
git.nix13.pw/scuroneko/extypes v1.2.0/go.mod h1:uZVs8Yo3RrYAG9dMad6qR6lsYY67t+459D9c65QAYAw=
|
||||
git.nix13.pw/scuroneko/laniakea v0.6.2 h1:YsXvTPB10lmunWiLGlYorrZ5qbYJp00xy8HSA/4EdyI=
|
||||
git.nix13.pw/scuroneko/laniakea v0.6.2/go.mod h1:ABjrmhKkTbhTwlMs+bLCr2e+ANnHbYTeidaicl2F0Z4=
|
||||
git.nix13.pw/scuroneko/laniakea v0.7.1 h1:OIIsZ4qdgHevicOHsYTD+yviGIxvd30Wi6j56QptC3Q=
|
||||
git.nix13.pw/scuroneko/laniakea v0.7.1/go.mod h1:ABjrmhKkTbhTwlMs+bLCr2e+ANnHbYTeidaicl2F0Z4=
|
||||
git.nix13.pw/scuroneko/slog v1.0.2 h1:vZyUROygxC2d5FJHUQM/30xFEHY1JT/aweDZXA4rm2g=
|
||||
git.nix13.pw/scuroneko/slog v1.0.2/go.mod h1:3Qm2wzkR5KjwOponMfG7TcGSDjmYaFqRAmLvSPTuWJI=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
||||
|
||||
2
main.go
2
main.go
@@ -16,7 +16,7 @@ func main() {
|
||||
database.ConnectMongo()
|
||||
database.ConnectRedis()
|
||||
|
||||
bot := laniakea.NewBot(laniakea.LoadSettingsFromEnv())
|
||||
bot := laniakea.NewBot(laniakea.LoadOptsFromEnv())
|
||||
defer bot.Close()
|
||||
bot = bot.ErrorTemplate("Во время выполнения команды произошла ошибка!\nСообщите об этом разработчику!\n\n%s")
|
||||
bot = bot.DatabaseContext(&laniakea.DatabaseContext{
|
||||
|
||||
Reference in New Issue
Block a user