Documentation
¶
Index ¶
- Variables
- func DbToGoType(colType string) string
- func ToStringSlice(val []interface{}) (result []string)
- type Field
- func (f *Field) ArgName() string
- func (f *Field) AsArgName(prefix string) string
- func (f *Field) AttrsContains(attr string) bool
- func (f *Field) BJTag() string
- func (f *Field) BsonTagName() string
- func (f *Field) DbName() string
- func (f *Field) DisableAutoInc() bool
- func (f *Field) Foreign() string
- func (f *Field) ForeignType() string
- func (f *Field) GetGoType() string
- func (f *Field) GetName() string
- func (f *Field) GetNullSQLType() string
- func (f *Field) GetTag() string
- func (f *Field) GetThriftType() string
- func (f *Field) GetTransformType() *Transform
- func (f *Field) HasBindData() bool
- func (f *Field) HasDefaultValue() bool
- func (f *Field) HasDisable() bool
- func (f *Field) HasEnums() bool
- func (f *Field) HasForeign() bool
- func (f *Field) HasHidden() bool
- func (f *Field) HasIndex() bool
- func (f *Field) HasMeta() bool
- func (f *Field) HasReadOnly() bool
- func (f *Field) HasRule() bool
- func (f *Field) HasStringList() bool
- func (f *Field) IsAutoInc() bool
- func (f *Field) IsNeedTransform() bool
- func (f *Field) IsNullable() bool
- func (f *Field) IsNullablePrimitive() bool
- func (f *Field) IsRequired() bool
- func (f *Field) IsUnique() bool
- func (f *Field) MysqlCreation() string
- func (f *Field) NullSQLTypeNeedCast() bool
- func (f *Field) NullSQLTypeValue() string
- func (f *Field) Read(data generator.Schema) error
- type ForeignKey
- type Generator
- type Index
- func (i *Index) CanUseFindIn() bool
- func (i *Index) CanUseFindList() bool
- func (i *Index) GetFieldList() string
- func (i *Index) GetFindInIds(idx int, bufName, name string) string
- func (i *Index) GetFirstField() *Field
- func (i *Index) GetFuncParam() string
- func (i *Index) GetFuncParamIn() string
- func (i *Index) GetFuncParamNames(prefixs ...string) string
- func (i *Index) GetFuncParamOriNames() string
- func (i *Index) IsFindInType(field *Field) bool
- func (i *Index) MysqlCreation(obj *Obj) string
- type ListedField
- type Obj
- func (o *Obj) DbContains(db string) bool
- func (o *Obj) DbSwitch(db string) bool
- func (o *Obj) FieldsMap() map[string]generator.IField
- func (o *Obj) GetAllNamesAsArgs(prefix string) []string
- func (o *Obj) GetByFields(f []*Field) []string
- func (o *Obj) GetConfigTemplates() []string
- func (o *Obj) GetFieldNameWithDB(name string) string
- func (o *Obj) GetFieldNames() []string
- func (o *Obj) GetFieldNamesAsArgs(prefix string) []string
- func (o *Obj) GetFilterFields() []*Field
- func (o *Obj) GetForeignKeys() []*Field
- func (o *Obj) GetFormImports() (imports []string)
- func (o *Obj) GetGenTypes() []string
- func (o *Obj) GetListedFields() []*ListedField
- func (o *Obj) GetNonIDFields() []*Field
- func (o *Obj) GetNonIdFieldNames() []string
- func (o *Obj) GetOrmImports() (imports []string)
- func (o *Obj) GetPrimaryKey() *Field
- func (o *Obj) GetPrimaryKeyName() string
- func (o *Obj) GetStringFilterFields() []*Field
- func (o *Obj) GetTable() string
- func (o *Obj) GetTimeFields() []*Field
- func (o *Obj) HasTimeFields() bool
- func (o *Obj) LoadField(f *Field) string
- func (o *Obj) LoadTpl(tpl string) string
- func (o *Obj) NeedIndex() bool
- func (o *Obj) NeedMapping() bool
- func (o *Obj) NeedOrm() bool
- func (o *Obj) NeedSearch() bool
- func (o *Obj) Read(name string, data generator.Schema) error
- type Transform
Constants ¶
This section is empty.
Variables ¶
View Source
var NullTypes = map[string]string{
"string": "String",
"bool": "Bool",
"int": "Int64",
"int32": "Int64",
"int64": "Int64",
"bit": "Bool",
"time.Time": "String",
"float": "Float64",
"float32": "Float64",
"float64": "Float64",
}
View Source
var SupportedFieldTypes = map[string]string{
"[]string": "list<string>",
"bool": "bool",
"datetime": "i64",
"float64": "double",
"int": "i32",
"int32": "i32",
"int64": "i64",
"string": "string",
}
View Source
var Tpl *template.Template
Functions ¶
func DbToGoType ¶
func ToStringSlice ¶
func ToStringSlice(val []interface{}) (result []string)
Types ¶
type Field ¶
type Field struct { Attrs map[string]string DefaultValue string Flags set.Set Index string Key string Label string PlaceHolder string Name string Order string Tag string Type string Size int // The field size, use for DDL generation. Decimal int // The decimal size, only use for "float64" type. Default string // The default value for this field, use for DDL generation. Widget string Remark string FK *ForeignKey Obj *Obj AsSort bool Comment string }
func (*Field) AttrsContains ¶
func (*Field) BsonTagName ¶
func (*Field) DisableAutoInc ¶
func (*Field) ForeignType ¶
func (*Field) GetNullSQLType ¶
func (*Field) GetThriftType ¶
func (*Field) GetTransformType ¶
func (*Field) HasBindData ¶
func (*Field) HasDefaultValue ¶
func (*Field) HasDisable ¶
func (*Field) HasForeign ¶
func (*Field) HasReadOnly ¶
func (*Field) HasStringList ¶
func (*Field) IsNeedTransform ¶
func (*Field) IsNullable ¶
func (*Field) IsNullablePrimitive ¶
func (*Field) IsRequired ¶
func (*Field) MysqlCreation ¶
func (*Field) NullSQLTypeNeedCast ¶
func (*Field) NullSQLTypeValue ¶
type ForeignKey ¶
func NewForeignKey ¶
func NewForeignKey(name string) *ForeignKey
type Generator ¶
type Generator struct{}
Generator is a generator that supports mysql and mongo drivers which share the same metadata format.
func (*Generator) DriverName ¶
type Index ¶
func (*Index) CanUseFindIn ¶
func (*Index) CanUseFindList ¶
func (*Index) GetFieldList ¶
func (*Index) GetFirstField ¶
func (*Index) GetFuncParam ¶
func (*Index) GetFuncParamIn ¶
func (*Index) GetFuncParamNames ¶
func (*Index) GetFuncParamOriNames ¶
func (*Index) IsFindInType ¶
func (*Index) MysqlCreation ¶
type ListedField ¶
type Obj ¶
type Obj struct { Db string Dbs []string Extend string Fields []*Field FieldNameMap map[string]*Field FilterFields []string Indexes []*Index Name string Namespace string // Package is deprecated , use Namespace instead Package string GoPackage string SearchIndex string SearchType string Table string TplWriter io.Writer DbName string StoreType string ValueType string ValueField *Field ModelType string ImportSQL string Comment string // IsEmbed describes whether the object should embedded in another object. // The embedded object will not generator the orm method but only the db struct. IsEmbed bool }
func (*Obj) DbContains ¶
func (*Obj) GetAllNamesAsArgs ¶
func (*Obj) GetByFields ¶
func (*Obj) GetConfigTemplates ¶
func (*Obj) GetFieldNameWithDB ¶
func (*Obj) GetFieldNames ¶
func (*Obj) GetFieldNamesAsArgs ¶
func (*Obj) GetFilterFields ¶
func (*Obj) GetForeignKeys ¶
func (*Obj) GetFormImports ¶
func (*Obj) GetGenTypes ¶
func (*Obj) GetListedFields ¶
func (o *Obj) GetListedFields() []*ListedField
func (*Obj) GetNonIDFields ¶
func (*Obj) GetNonIdFieldNames ¶
func (*Obj) GetOrmImports ¶
func (*Obj) GetPrimaryKey ¶
func (*Obj) GetPrimaryKeyName ¶
func (*Obj) GetStringFilterFields ¶
func (*Obj) GetTimeFields ¶
func (*Obj) HasTimeFields ¶
func (*Obj) NeedMapping ¶
func (*Obj) NeedSearch ¶
Click to show internal directories.
Click to hide internal directories.