Documentation ¶
Index ¶
- Variables
- func CallHook(st interface{}, method string, arg string) string
- func DeleteQuery(tableName, index string) string
- func DropTableQuery(name string, ifExists bool) string
- func InsertQuery(st interface{}, tableName string, columnNames []string) string
- func MatchType(typeName string) (string, error)
- func NewFieldQueries(fields []*Options) string
- func NewFieldQuery(field *Options) string
- func NewPrimaryKeyQuery(st interface{}, fields []*Options) string
- func NewTableConfigQuery(fields []*Options) string
- func NewTableQuery(st interface{}, name string, fields []*Options, ifNotExists bool) string
- func SelectQuery(tableName string, columnNames []string) string
- func ShowTablesLikeQuery(name string) string
- func UpdateAllQuery(tableName string, columnNames []string) string
- func UpdateQuery(tableName, index string, columnNames []string) string
- type Options
- func (options *Options) ReadAttr(input string, names ...string) (string, bool)
- func (options *Options) ReadAutoIncrement(input string) bool
- func (options *Options) ReadDefaultValue(input string) bool
- func (options *Options) ReadName(input string) bool
- func (options *Options) ReadTableName(input string) bool
- func (options *Options) ReadType(input string) bool
- func (options *Options) ReadTypeAttr(input string) bool
Constants ¶
This section is empty.
Variables ¶
View Source
var TypeDict = map[string]string{
"float32": "float",
"float64": "float",
"int": "int",
"uint": "int",
"int64": "bigint",
"uint64": "bigint",
"string": "varchar",
"time.Time": "timestamp",
"bool": "tinyint",
"[]byte": "blob",
"[]uint8": "blob",
"sql.NullFloat32": "float",
"sql.NullFloat64": "float",
"sql.NullInt64": "bigint",
"sql.NullString": "varchar",
"sql.NullBool": "tinyint",
}
View Source
var Types = map[string]int{
"int": 11,
"bigint": 20,
"varchar": 255,
"text": -1,
"date": -1,
"time": -1,
"timestamp": -1,
}
Functions ¶
func DeleteQuery ¶
func DropTableQuery ¶
func InsertQuery ¶
func NewFieldQueries ¶
func NewFieldQuery ¶
func NewPrimaryKeyQuery ¶
func NewTableConfigQuery ¶
func NewTableQuery ¶
func SelectQuery ¶
func ShowTablesLikeQuery ¶
func UpdateAllQuery ¶
func UpdateQuery ¶
Types ¶
type Options ¶
type Options struct { Name string Type string Length int DefaultValue string AutoIncrement int IsAutoIncrementing bool IsPrimaryKey bool IsUnique bool IsUnsigned bool IsRequired bool Ignore bool Conflict string TableName string }
func NewOptions ¶
func (*Options) ReadAutoIncrement ¶
func (*Options) ReadDefaultValue ¶
func (*Options) ReadTableName ¶
func (*Options) ReadTypeAttr ¶
Click to show internal directories.
Click to hide internal directories.