Documentation ¶
Index ¶
- Constants
- func Copy(dst interface{}, src interface{}) error
- func EnumValue(v string) (val []string)
- func Float64() float64
- func FmtFieldName(s string) string
- func FmtFieldName2(s string) string
- func GetRandom(length int) int
- func GetRandomString(n int) (s string)
- func GetTableDesc(db *sql.DB, tableName string) (fieldDef map[string]interface{}, primaryKey []string, err error)
- func GetTablePrimaryKey(db *sql.DB, dbName, tableName string) (primaryKey []string, err error)
- func GetTableRemark(db *sql.DB, dbName, tableName string) (remark string, err error)
- func Int63() int64
- func Int63n(n int64) int64
- func Intn(n int) int
- func Query(db *sql.DB, queryStr string, args ...interface{}) ([]map[string]interface{}, error)
- func StrToInt(str string) (i int)
- func String(n int, charset string) (string, error)
- type ColumnInfo
- type ModelInfo
Constants ¶
View Source
const ( // Set of characters to use for generating random strings Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" Numerals = "1234567890" Alphanumeric = Alphabet + Numerals Ascii = Alphanumeric + "~!@#$%^&*()-_+={}[]\\|<,>.?/\"';:`" )
Variables ¶
This section is empty.
Functions ¶
func FmtFieldName ¶
fmtFieldName formats a string as a struct key
Example:
fmtFieldName("foo_id")
Output: FooID
func FmtFieldName2 ¶
func GetRandomString ¶
AlphaString returns a random alphanumeric string n characters long.
func GetTableDesc ¶
func GetTableDesc(db *sql.DB, tableName string) (fieldDef map[string]interface{}, primaryKey []string, err error)
默认值
func GetTablePrimaryKey ¶
主键
func GetTableRemark ¶
表备注
func Int63 ¶
func Int63() int64
Int63 returns a non-negative pseudo-random 63-bit integer as an int64.
func Int63n ¶
Int63n returns, as an int64, a non-negative pseudo-random number in [0,n). It panics if n <= 0.
func Intn ¶
Intn returns, as an int, a non-negative pseudo-random number in [0,n). It panics if n <= 0.
Types ¶
type ColumnInfo ¶
type ColumnInfo struct { ColumnName string `json:"column_name"` //字段名称 IsNullable string `json:"is_nullable"` //是否允许为空 DataType string `json:"data_type"` //字段类型 ColumnType string `json:"column_type"` //详细字段类型 CharacterMaximumLength2 string `json:"character_maximum_length"` //长度 CharacterOctetLength2 string `json:"character_octet_length"` //字符八位字节长度 NumericPrecision2 string `json:"numeric_precision"` //double/floag/numeric 长度 NumericScale2 string `json:"numeric_scale"` //小数点 CharacterMaximumLength int //长度 CharacterOctetLength int //字符八位字节长度 NumericPrecision int //double/floag/numeric 长度 NumericScale int //小数点 ColumnComment string `json:"column_comment"` //字段备注 ColumnItemValue []string //字段项值,如:enum('保密','男','女') ColumnCNName string //中文名称 DataTypeLower string //小写 StructName string //StructName Valid []string //字段验证标记 FormType string //表单类型,text:字符长度小于300输入框,number:数字类型,time:时间类型,date:日期类型, AddTestValue interface{} //添加测试的,字段test时值 UpdateTestValue interface{} //修改测试的,字段test时值 PrimaryKey bool //是否为主键 PageTable map[string]bool //页面控制,search:可搜索,none:不显示,如:Table[none]或Table[search] PageForm map[string]bool //页面控制,none:不显示,如:Form[none] }
func GetTableColumnRemark ¶
func GetTableColumnRemark(db *sql.DB, dbName, tableName string) (cols []*ColumnInfo, err error)
字段备注
type ModelInfo ¶
Click to show internal directories.
Click to hide internal directories.