dbconn

package
v0.0.0-...-5f9bd54 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Gorm  *gorm.DB
	SqlDB *sql.DB
}

type DBConnectionInfo

type DBConnectionInfo struct {
	Server     string `toml:"server" yaml:"server"`
	User       string `toml:"user" yaml:"user"`
	Passwd     string `toml:"password" yaml:"password"`
	Database   string `toml:"database" yaml:"database"`
	Driver     string `toml:"driver" yaml:"driver"`
	Option     string `toml:"option" yaml:"option"`
	LogMode    bool   `toml:"logmode" yaml:"logmode"`
	TestOnBoot bool   `toml:"test-on-boot" yaml:"test-on-boot"`
	Disable    bool   `toml:"disable" yaml:"disable"`
	IntegerTag int    `toml:"integer-tag" yaml:"integer-tag"`
	StringTag  string `toml:"string-tag" yaml:"string-tag"`
}

type DbColumn

type DbColumn struct {
	Name          string
	TypeName      string
	MariadbType   string
	Nullable      bool
	ColumnDefault sql.NullString
	OctetLength   sql.NullInt64
	ColumnType    reflect.Type
}

type DbIndex

type DbIndex struct {
	Name    string
	Columns []string
	Unique  bool
}

type IDBConnection

type IDBConnection interface {
	GetConnection(callback func(xdb *DB) (interface{}, error)) (interface{}, error)
	GetExtraProperty(property string) interface{}
	GetDialect() IDbDialect
}

type IDBConnectionExtended

type IDBConnectionExtended interface {
	GetTables(dbName string) ([]string, error)
	GetColumns(dbName, tableName string) ([]DbColumn, error)
	GetPrimaryKey(dbName, dbTable string) ([]string, error)
	GetIndexes(dbName, dbTable string) ([]*DbIndex, error)
}

type IDatabase

type IDatabase interface {
	Name() string
	Tables() []string
	Table(tableName string) IDbTable
}

type IDatabaseUtil

type IDatabaseUtil interface {
	GetDBConnection() IDBConnection
	GetDatabase() (IDatabase, error)
	GetDatabaseByName(dbname string) (IDatabase, error)
	CloneTable(tbl IDbTable, intercept func(columns []string, variables []interface{}) (bool, bool)) (int, int, error)
}

type IDbColumn

type IDbColumn interface {
	Name() string
	Table() IDbTable
	Database() IDatabase
}

type IDbDialect

type IDbDialect interface {
	Bra() string
	Ket() string
}

type IDbTable

type IDbTable interface {
	Name() string
	Database() IDatabase
	Columns() []string
	PrimaryKey() []string
	Column(colName string) IDbColumn
	Indexes() []*DbIndex
	ShowCreateTable() string
	DropTableQuery() string
	SelectAll(callback func(columns []string, args ...interface{}) bool) error
}

type IHaveForeignKey

type IHaveForeignKey interface {
	AddForeignKey(xdb *DB)
}

type IMigratable

type IMigratable interface {
	AutoMigrate(xdb *DB)
}

Jump to

Keyboard shortcuts

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