Documentation
¶
Index ¶
- Variables
- func Add(a, b int) int
- func Camel2Name(s string) string
- func CamelName(argName string) string
- func Divide(a, b int) int
- func GenerateConfTemplate(output string, packageName string) error
- func GenerateGoTemplate(output string, obj *MetaObject) error
- func GenerateScriptTemplate(output string, driver string, obj *MetaObject) error
- func Multiply(a, b int) int
- func Sub(a, b int) int
- type Field
- func (f *Field) ColumnName() string
- func (f *Field) FieldName() string
- func (f *Field) GetGoType() string
- func (f *Field) GetName() string
- func (f *Field) GetNames() string
- func (f *Field) GetNullSQLType() string
- func (f *Field) GetTag() string
- func (f *Field) GetTransform() *Transform
- func (f *Field) GetTransformValue(prefix string) string
- func (f *Field) GetType() string
- func (f *Field) GetUnderlineName() string
- func (f *Field) GetUnderlineNames() string
- func (f *Field) HasIndex() bool
- func (f *Field) IsAutoIncrement() bool
- func (f *Field) IsBool() bool
- func (f *Field) IsEncode() bool
- func (f *Field) IsFullText() bool
- func (f *Field) IsIndex() bool
- func (f *Field) IsNeedTransform() bool
- func (f *Field) IsNorange() bool
- func (f *Field) IsNullable() bool
- func (f *Field) IsNullablePrimitive() bool
- func (f *Field) IsNumber() bool
- func (f *Field) IsPrimary() bool
- func (f *Field) IsRange() bool
- func (f *Field) IsString() bool
- func (f *Field) IsTime() bool
- func (f *Field) IsUnique() bool
- func (f *Field) NullSQLTypeNeedCast() bool
- func (f *Field) NullSQLTypeValue() string
- func (f *Field) Read(data generator.Schema) error
- func (f *Field) SQLColumn() string
- func (f *Field) SQLDefault() string
- func (f *Field) SQLName() string
- func (f *Field) SQLNull() string
- func (f *Field) SQLType() string
- func (f *Field) SetType(t string) error
- type Fields
- type Index
- func (idx *Index) FirstField() *Field
- func (idx *Index) GetConstructor() string
- func (idx *Index) GetFieldNames() string
- func (idx *Index) GetFuncName() string
- func (idx *Index) GetFuncParam() string
- func (idx *Index) GetPrettyName() string
- func (idx *Index) HasPrimaryKey() bool
- func (idx *Index) IsSingleField() bool
- func (idx *Index) LastField() *Field
- type IndexArray
- type MetaObject
- func (m *MetaObject) Comment() string
- func (o *MetaObject) DbSource() string
- func (o *MetaObject) FieldByName(name string) *Field
- func (o *MetaObject) Fields() []*Field
- func (o *MetaObject) FieldsMap() map[string]generator.IField
- func (o *MetaObject) FromDB() string
- func (o *MetaObject) GetTable() string
- func (o *MetaObject) Indexes() []*Index
- func (o *MetaObject) LastField() *Field
- func (o *MetaObject) NoneIncrementFields() []*Field
- func (o *MetaObject) NotPrimaryIndexes() []*Index
- func (o *MetaObject) NotPrimaryUniques() []*Index
- func (o *MetaObject) PrimaryField() *Field
- func (o *MetaObject) PrimaryKey() *PrimaryKey
- func (o *MetaObject) Ranges() []*Index
- func (o *MetaObject) Read(name string, data generator.Schema) error
- func (o *MetaObject) Uniques() []*Index
- type MySQLRGenerator
- type PrimaryKey
- func (pk *PrimaryKey) FirstField() *Field
- func (pk *PrimaryKey) GetConstructor() string
- func (pk *PrimaryKey) GetFuncParam() string
- func (pk *PrimaryKey) GetObjectParam() string
- func (pk *PrimaryKey) IsAutoIncrement() bool
- func (pk *PrimaryKey) IsRange() bool
- func (pk *PrimaryKey) IsSingleField() bool
- func (pk *PrimaryKey) SQLColumn() string
- type Transform
Constants ¶
This section is empty.
Variables ¶
View Source
var SupportedFieldTypes = map[string]string{
"bool": "bool",
"int": "int32",
"int8": "int8",
"int16": "int16",
"int32": "int32",
"int64": "int64",
"uint": "uint32",
"uint8": "uint8",
"uint16": "uint16",
"uint32": "uint32",
"uint64": "uint64",
"float32": "float32",
"float64": "float64",
"string": "string",
"datetime": "datetime",
"timestamp": "timestamp",
"timeint": "timeint",
}
Functions ¶
func Camel2Name ¶
func GenerateConfTemplate ¶
func GenerateGoTemplate ¶
func GenerateGoTemplate(output string, obj *MetaObject) error
func GenerateScriptTemplate ¶
func GenerateScriptTemplate(output string, driver string, obj *MetaObject) error
Types ¶
type Field ¶
type Field struct { Name string Type string Size int Flags set.Set Attrs map[string]string Comment string Validator string Obj *MetaObject Default interface{} // contains filtered or unexported fields }
func (*Field) ColumnName ¶
func (*Field) GetNullSQLType ¶
func (*Field) GetTransform ¶
func (*Field) GetTransformValue ¶
func (*Field) GetUnderlineName ¶ added in v2.4.1
func (*Field) GetUnderlineNames ¶ added in v2.4.1
func (*Field) IsAutoIncrement ¶
func (*Field) IsFullText ¶
func (*Field) IsNeedTransform ¶
func (*Field) IsNullable ¶
func (*Field) IsNullablePrimitive ¶
func (*Field) NullSQLTypeNeedCast ¶
func (*Field) NullSQLTypeValue ¶
func (*Field) SQLDefault ¶
type Fields ¶
type Fields []*Field
func (Fields) GetConstructor ¶
func (Fields) GetFieldNames ¶ added in v2.4.0
func (Fields) GetFuncParam ¶
func (Fields) GetObjectParam ¶
type Index ¶
type Index struct { Name string PrettyName string Fields []*Field FieldNames []string Obj *MetaObject }
func NewIndex ¶
func NewIndex(obj *MetaObject) *Index
func (*Index) FirstField ¶
func (*Index) GetConstructor ¶
func (*Index) GetFieldNames ¶ added in v2.4.0
func (*Index) GetFuncName ¶
func (*Index) GetFuncParam ¶
func (*Index) GetPrettyName ¶ added in v2.6.10
func (*Index) HasPrimaryKey ¶
func (*Index) IsSingleField ¶
type IndexArray ¶
type IndexArray []*Index
type MetaObject ¶
type MetaObject struct { //! package name // Package is deprecated, use Namespace instead. Package string GoPackage string Namespace string //! model name Name string Tag string //! dbs Db string //! database DbName string DbTable string DbView string //! importSQL ImportSQL string // contains filtered or unexported fields }
func NewMetaObject ¶
func NewMetaObject(namespace string, packageName string) *MetaObject
func (*MetaObject) Comment ¶
func (m *MetaObject) Comment() string
func (*MetaObject) DbSource ¶
func (o *MetaObject) DbSource() string
func (*MetaObject) FieldByName ¶
func (o *MetaObject) FieldByName(name string) *Field
func (*MetaObject) Fields ¶
func (o *MetaObject) Fields() []*Field
func (*MetaObject) FromDB ¶
func (o *MetaObject) FromDB() string
func (*MetaObject) GetTable ¶
func (o *MetaObject) GetTable() string
func (*MetaObject) Indexes ¶
func (o *MetaObject) Indexes() []*Index
func (*MetaObject) LastField ¶
func (o *MetaObject) LastField() *Field
func (*MetaObject) NoneIncrementFields ¶
func (o *MetaObject) NoneIncrementFields() []*Field
func (*MetaObject) NotPrimaryIndexes ¶ added in v2.6.9
func (o *MetaObject) NotPrimaryIndexes() []*Index
func (*MetaObject) NotPrimaryUniques ¶ added in v2.6.9
func (o *MetaObject) NotPrimaryUniques() []*Index
func (*MetaObject) PrimaryField ¶
func (o *MetaObject) PrimaryField() *Field
func (*MetaObject) PrimaryKey ¶
func (o *MetaObject) PrimaryKey() *PrimaryKey
func (*MetaObject) Ranges ¶
func (o *MetaObject) Ranges() []*Index
func (*MetaObject) Uniques ¶
func (o *MetaObject) Uniques() []*Index
type MySQLRGenerator ¶
type MySQLRGenerator struct{}
func (*MySQLRGenerator) DriverName ¶
func (g *MySQLRGenerator) DriverName() string
type PrimaryKey ¶
type PrimaryKey struct { Name string FieldNames []string Fields []*Field Obj *MetaObject }
func NewPrimaryKey ¶
func NewPrimaryKey(obj *MetaObject) *PrimaryKey
func (*PrimaryKey) FirstField ¶
func (pk *PrimaryKey) FirstField() *Field
func (*PrimaryKey) GetConstructor ¶
func (pk *PrimaryKey) GetConstructor() string
func (*PrimaryKey) GetFuncParam ¶
func (pk *PrimaryKey) GetFuncParam() string
func (*PrimaryKey) GetObjectParam ¶
func (pk *PrimaryKey) GetObjectParam() string
func (*PrimaryKey) IsAutoIncrement ¶
func (pk *PrimaryKey) IsAutoIncrement() bool
func (*PrimaryKey) IsRange ¶
func (pk *PrimaryKey) IsRange() bool
func (*PrimaryKey) IsSingleField ¶
func (pk *PrimaryKey) IsSingleField() bool
func (*PrimaryKey) SQLColumn ¶
func (pk *PrimaryKey) SQLColumn() string
Click to show internal directories.
Click to hide internal directories.