micro-examples/pubsub/database.go
Vasiliy Tolstov ce39374ff5 add pubsub
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-11-28 14:49:22 +03:00

22 lines
481 B
Go

package main
import (
"github.com/jmoiron/sqlx"
_ "modernc.org/sqlite"
)
func DatabaseConnect(cfg *DatabaseConfig) (*sqlx.DB, error) {
/*
db, err := sqlx.Connect("sqlite", cfg.Name)
if err != nil {
return nil, err
}
db.SetMaxOpenConns(int(cfg.ConnMax))
db.SetMaxIdleConns(int(cfg.ConnMax / 2))
db.SetConnMaxLifetime(time.Duration(cfg.ConnLifetime) * time.Second)
db.SetConnMaxIdleTime(time.Duration(cfg.ConnMaxIdleTime) * time.Second)
*/
return nil, nil
}