dbutil

package
v0.0.0-...-be15534 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSQLStrictMode

func GetSQLStrictMode() string

GetSQLStrictMode return SQL strict mode for metastore Use strict mode to avoid unexpected silent processing of meta data

func NewSQLDB

func NewSQLDB(driver string, dsn string, dbConf *DBConfig) (*sql.DB, error)

NewSQLDB return sql.DB for specified driver and dsn

Types

type DBConfig

type DBConfig struct {
	ConnMaxIdleTime time.Duration `toml:"conn-max-idle-time" json:"conn-max-idle-time"`
	ConnMaxLifeTime time.Duration `toml:"conn-max-life-time" json:"conn-max-life-time"`
	MaxIdleConns    int           `toml:"max-idle-conns" json:"max-idle-conns"`
	MaxOpenConns    int           `toml:"max-open-conns" json:"max-open-conns"`
}

DBConfig defines some configuration used in database connection refer to: https://pkg.go.dev/database/sql#SetConnMaxIdleTime

func DefaultDBConfig

func DefaultDBConfig() *DBConfig

DefaultDBConfig creates a default DBConfig

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL