dialect

package
v0.0.0-...-803ac38 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Mysql      = "mysql"
	Sqlite3    = "sqlite3"
	Postgresql = "postgresql"
)
View Source
const (
	UpperLetterStartIdx = 65
	LowerLetterStartIdx = 97
)

Variables

This section is empty.

Functions

func ConvertHumpToUnderline

func ConvertHumpToUnderline(column []byte) string

ConvertHumpToUnderline 将驼峰英文命名转换为下划线英文命名

func ConvertToLower

func ConvertToLower(val []byte) string

ConvertToLower 将大写英文字母转为小写英文字母

func ConvertToUpper

func ConvertToUpper(val []byte) string

ConvertToUpper 将小写英文字母转为大写英文字母

func ParseKeywordAndArgument

func ParseKeywordAndArgument(val string) (string, string)

func Register

func Register(name string, dialect Dialect)

Register 注册一个 Dialect

Types

type Dialect

type Dialect interface {
	// GetName 获取数据表的名称
	GetName() string
	// NewColumn 创建一个字段
	NewColumn() column.Column
	// GetType 判断指定类型是否存在
	GetType(typ string) (string, bool)
	// ConvertDefaultType 获取数据库默认类型
	ConvertDefaultType(val reflect.Value) string
	// GenerateCreatingColumnSQL 生成创建数据表的 SQL 语句
	GenerateCreatingTableSQL(tabName string, columns []column.Column, engName ...string) string
	// GenerateQueryingTableSQL 生成检查数据表是否存在的 SQL 语句
	GenerateQueryingTableSQL(dbName, tabName string) string
}

func Get

func Get(name string) Dialect

Get 获取指定驱动的 Dialect

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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