micro-examples/http/database.go
Vasiliy Tolstov 5608190dbf initial import
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-11-28 12:39:25 +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
}