20 lines
411 B
Go
20 lines
411 B
Go
package valkey
|
|
|
|
import (
|
|
"git.tek.govt.hu/dowerx/chat/server/config"
|
|
"git.tek.govt.hu/dowerx/chat/server/util"
|
|
"github.com/valkey-io/valkey-go"
|
|
)
|
|
|
|
var vk valkey.Client = nil
|
|
|
|
func getClient() (*valkey.Client, *util.ChatError) {
|
|
if vk == nil {
|
|
client, err := valkey.NewClient(config.GetConfig().Valkey)
|
|
vk = client
|
|
return &vk, util.MakeError(err, util.DATABASE_CONNECTION_FAULT)
|
|
}
|
|
|
|
return &vk, nil
|
|
}
|