Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSqlDB ¶
func NewSqlDB(cfg *conf.Configuration) *sql.DB
NewSqlDB create a sql.DB instance from config.
Configuration example:
dbname:
driverName: testDriver
dsn: root:123456@tcp(127.0.0.1:3306)
maxIdleConns: 10
maxOpenConns: 100
connMaxLifetime:
Encrypted password example:
dbname:
driverName: testDriver
dsn: root:${password}@tcp(127.0.0.1:3306)
maxIdleConns: 10
maxOpenConns: 100
connMaxLifetime:
encryption:
password: U2FsdGVkX1+tlVEqk7q5J4HmwH0tZg
method: aes-gcm
if use encrypted password, you need pass the env "DB_SECRET_KEY" which used AES-GCM encrypted by default
func RegisterEncryptor ¶ added in v0.5.4
RegisterEncryptor register a new encryptor
Types ¶
Click to show internal directories.
Click to hide internal directories.