schema

package
v0.0.0-...-66c7839 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PKType

type PKType int
var (
	PKTypeAllColumns PKType = 10
	PKTypePK         PKType = 20
	PKTypeUK         PKType = 30
)

type Table

type Table struct {
	SchemaName     string
	TableName      string
	ColumnNames    []string       // 表所有的字段
	ColumnPosMap   map[string]int // 每个字段对应的slice位置
	UseColumnNames []string       // 最终需要使用的字段
	UseColumnPos   []int          // 字段对应的位点
	PKColumnNames  []string       // 主键的所有字段
	PKType                        // 主键类型 全部列. 主键. 唯一键
	InsertTemplate string         // insert sql 模板
	UpdateTemplate string         // update sql 模板
	DeleteTemplate string         // delete sql 模板
	CalcOp         []interface{}
}

func NewTable

func NewTable(sName string, tName string) (*Table, error)

func NewTableWithStmt

func NewTableWithStmt(createStmtNode *ast.CreateTableStmt) (*Table, error)

func (*Table) FilterRow

func (this *Table) FilterRow(row []interface{}) bool

过滤行

func (*Table) GetPKCrc32

func (this *Table) GetPKCrc32(row []interface{}) uint32

func (*Table) GetPKValues

func (this *Table) GetPKValues(row []interface{}) []interface{}

func (*Table) GetUseRow

func (this *Table) GetUseRow(row []interface{}) ([]interface{}, error)

获取只用字段

func (*Table) InitSQLTemplate

func (this *Table) InitSQLTemplate()

初始化sql模板

func (*Table) SetMTableInfo

func (this *Table) SetMTableInfo(mTable *visitor.MatchTable) error

设置 MTableInfo

func (*Table) SetPKValues

func (this *Table) SetPKValues(row []interface{}, pkValues []interface{})

func (*Table) String

func (this *Table) String() string

Jump to

Keyboard shortcuts

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