model

package
v0.0.0-...-e8181bf Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 2 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CIStr

type CIStr struct {
	O string `json:"O"` // Original string.
	L string `json:"L"` // Lower case string.
}

CIStr is case insensitive string.

func NewCIStr

func NewCIStr(s string) (cs CIStr)

NewCIStr creates a new CIStr.

func (CIStr) String

func (cis CIStr) String() string

String implements fmt.Stringer interface.

type ColumnInfo

type ColumnInfo struct {
	Name            CIStr       `json:"name"`
	Offset          int         `json:"offset"`
	DefaultValue    interface{} `json:"default"`
	types.FieldType `json:"type"`
	Comment         string `json:"comment"`
}

ColumnInfo provides meta data describing of a table column.

func (*ColumnInfo) Clone

func (c *ColumnInfo) Clone() *ColumnInfo

Clone clones ColumnInfo.

type DBInfo

type DBInfo struct {
	Name   CIStr        `json:"db_name"` // DB name.
	Tables []*TableInfo `json:"-"`       // Tables in the DB.
}

DBInfo provides meta data describing a DB.

func (*DBInfo) Clone

func (db *DBInfo) Clone() *DBInfo

Clone clones DBInfo.

type IndexColumn

type IndexColumn struct {
	Name CIStr `json:"name"` // Index name
}

IndexColumn provides index column info.

func (*IndexColumn) Clone

func (i *IndexColumn) Clone() *IndexColumn

Clone clones IndexColumn.

type IndexInfo

type IndexInfo struct {
	Name    CIStr          `json:"idx_name"`   // Index name.
	Table   CIStr          `json:"tbl_name"`   // Table name.
	Columns []*IndexColumn `json:"idx_cols"`   // Index columns.
	Unique  bool           `json:"is_unique"`  // Whether the index is unique.
	Primary bool           `json:"is_primary"` // Whether the index is primary key.
	Comment string         `json:"comment"`    // Comment
	Tp      IndexType      `json:"index_type"` // Index type: Btree or Hash
}

IndexInfo provides meta data describing a DB index. It corresponds to the statement `CREATE INDEX Name ON Table (Column);` See https://dev.mysql.com/doc/refman/5.7/en/create-index.html

func (*IndexInfo) Clone

func (index *IndexInfo) Clone() *IndexInfo

Clone clones IndexInfo.

type IndexType

type IndexType int

IndexType is the type of index

const (
	IndexTypeBtree IndexType = iota + 1
	IndexTypeHash
)

IndexTypes

func (IndexType) String

func (t IndexType) String() string

String implements Stringer interface.

type TableInfo

type TableInfo struct {
	Name    CIStr         `json:"name"`
	Columns []*ColumnInfo `json:"cols"` // Columns are listed in the order in which they appear in the schema.
	Indices []*IndexInfo  `json:"index_info"`
	Comment string        `json:"comment"`
}

TableInfo provides meta data describing a DB table.

func (*TableInfo) Clone

func (t *TableInfo) Clone() *TableInfo

Clone clones TableInfo.

Jump to

Keyboard shortcuts

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