mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-18 13:52:51 +00:00
19 lines
379 B
Go
19 lines
379 B
Go
package database
|
|
|
|
import (
|
|
"database/sql"
|
|
)
|
|
|
|
func Connect(config Config) (*sql.DB, error) {
|
|
client, err := sql.Open("postgres", config.String())
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
client.SetMaxOpenConns(int(config.MaxOpenConns))
|
|
client.SetConnMaxLifetime(config.MaxConnLifetime.Duration)
|
|
client.SetConnMaxIdleTime(config.MaxConnIdleTime.Duration)
|
|
|
|
return client, nil
|
|
}
|