db

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dao

type Dao interface {
	SetDB(dc *DbConf)          // 设置数据源
	QueryTables() []*TableInfo // 查询所有表
}

func NewDao

func NewDao(dbType string) Dao

type DaoBase

type DaoBase struct {
	// contains filtered or unexported fields
}

type DbConf

type DbConf struct {
	User            string `json:"user"`            // 用户
	Password        string `json:"password"`        // 密码
	Host            string `json:"host"`            // 主机地址
	Port            string `json:"port"`            // 端口
	Database        string `json:"database"`        // 数据库
	Schema          string `json:"schema"`          // 多租户
	Tabel           string `json:"table"`           // 表名
	Charset         string `json:"charset"`         // 默认 UTF8
	ParseTime       bool   `json:"parseTime"`       // 默认 true
	MaxOpenConns    int    `json:"maxOpenConns"`    // 最大连接数 默认 1
	MaxIdleConns    int    `json:"maxIdleConns"`    // 初始化连接数 默认 1
	ConnMaxLifetime int    `json:"connMaxLifetime"` // 存活时间 默认30s
}

func NewDbConf

func NewDbConf(host, port, user, pass, database, schema, table string) *DbConf

type TableInfo

type TableInfo struct {
	TabelName     string `db:"TABLE_NAME"`
	ColumnName    string `db:"COLUMN_NAME"`
	ColumnType    string `db:"COLUMN_TYPE"`
	ColumnComment string `db:"COLUMN_COMMENT"`
}

Jump to

Keyboard shortcuts

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