database

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDataBase

func NewDataBase(
	driver string,
	host string,
	port uint,
	dbname string,
	instanceName string,
	user string,
	password string,
	sslMode bool,
	dialTimeout time.Duration,
	options ...Option,
) (*xorm.Engine, error)

Types

type DataSourceTypeName

type DataSourceTypeName string
const (
	CloudMySql DataSourceTypeName = "cloud_mysql"
	Mysql      DataSourceTypeName = "mysql"
	Postgresql DataSourceTypeName = "postgres"
	Sqlite     DataSourceTypeName = "sqlite"
)

type Option

type Option interface {
	Apply(*xorm.Engine)
}

An Option configures a xorm.Engine

func SetConnMaxLifetime

func SetConnMaxLifetime(maxlifetime time.Duration) Option

func SetLogLevel

func SetLogLevel(logLevel log.LogLevel) Option

func SetLogger

func SetLogger(logger interface{}) Option

func SetMapper

func SetMapper(mapper names.Mapper) Option

func SetMaxIdleConns

func SetMaxIdleConns(maxIdleConns int) Option

func SetMaxOpenConns

func SetMaxOpenConns(maxOpenConns int) Option

func SetShowSQL

func SetShowSQL(showSQL ...bool) Option

type OptionFunc

type OptionFunc func(*xorm.Engine)

OptionFunc is a function that configures a xorm.Engine

func (OptionFunc) Apply

func (f OptionFunc) Apply(engine *xorm.Engine)

Apply is a function that set value to xorm.Engine

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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