driver

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitMysql

func InitMysql(config vars.DatabaseConfig) *gorm.DB

Types

type I

type I interface {
	TransType(filedType string, nullable string) string
	GetTableStructure(schema string, tables []string) []vars.Structure
}

func GetInstance

func GetInstance(config vars.DatabaseConfig) I

type Mysql

type Mysql struct {
	PublicFunc
}

func NewMysql

func NewMysql(config vars.DatabaseConfig) *Mysql

func (*Mysql) GetTableStructure

func (m *Mysql) GetTableStructure(schema string, tables []string) []vars.Structure

func (*Mysql) HasSpecialType added in v0.3.0

func (m *Mysql) HasSpecialType(fields []vars.Field) (hasNull bool, hasTime bool)

func (*Mysql) TransType

func (m *Mysql) TransType(filedType string, nullable string) string

TransType 翻译数据类型,从mysql的格式到golang的格式

type Postgres

type Postgres struct {
	PublicFunc
}

func NewPostgres

func NewPostgres() *Postgres

func (*Postgres) GetTableStructure

func (p *Postgres) GetTableStructure(schema string, tables []string) []vars.Structure

func (*Postgres) Init

func (*Postgres) Init(dbc vars.DatabaseConfig) []vars.Structure

func (*Postgres) TransType

func (p *Postgres) TransType(filedType string, nullable string) string

type PublicFunc

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

PublicFunc 公共方法,可复用

Jump to

Keyboard shortcuts

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