sqlgenerator

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reserved added in v0.0.30

type Reserved interface {
	IsReserved(word string) bool
	CheckReserved(word string) string
}

func GetReserved added in v0.0.30

func GetReserved(dialect constants.DIALECT) (Reserved, error)

type SQL

type SQL struct {
	TableName                string
	Columns                  []string
	SelectFields             []string
	ParamPlaceHolder         []string
	Params                   []*SQLParam
	Where                    string
	WhereParams              []*SQLParam
	ReturnAutoincrPrimaryKey string // insert 时是否返回自增主键
	OrderAndGroup            string
}

type SQLGenerator

type SQLGenerator interface {
	Reserved
	Insert(sql *SQL) (string, []*SQLParam)
	Update(sql *SQL) (string, []*SQLParam, []*SQLParam)
	Delete(sql *SQL) (string, []*SQLParam)
	Query(sql *SQL) (string, []*SQLParam)
	Truncate(sql *SQL) string
	IsReturnAutoincrPrimaryKeyUseQuery() bool
	IsParamDollar() bool
	GetParamTag() string
}

func GetGenerator

func GetGenerator(dialect constants.DIALECT) (SQLGenerator, error)

type SQLParam

type SQLParam struct {
	VarName           string
	JSON              bool
	Time              bool
	Blob              bool // 实现了 BlobReadWriter
	SQLType           string
	VarAlias          string
	TimeProp          *dbutil.TimePropDesc
	SQLParamName      string // 从 SQL 语句中分析出来的参数名称,不作任何改变
	SQLParamFieldName string

	IsInOperator       bool
	InParamPlaceHolder string // in 操作符占位字符串
}

Jump to

Keyboard shortcuts

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