parser

package
v0.0.0-...-56ba520 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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",
}

Functions

func DbToGoType

func DbToGoType(colType string) string

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
	Widget       string
	Remark       string
	FK           string
	Obj          *Obj
}

func (*Field) BJTag

func (f *Field) BJTag() string

func (*Field) Foreign

func (f *Field) Foreign() string

func (*Field) ForeignType

func (f *Field) ForeignType() string

func (*Field) GetGoType

func (f *Field) GetGoType() string

func (*Field) GetNullSQLType

func (f *Field) GetNullSQLType() string

func (*Field) GetThriftType

func (f *Field) GetThriftType() string

func (*Field) HasBindData

func (f *Field) HasBindData() bool

func (*Field) HasDefaultValue

func (f *Field) HasDefaultValue() bool

func (*Field) HasDisable

func (f *Field) HasDisable() bool

func (*Field) HasEnums

func (f *Field) HasEnums() bool

func (*Field) HasForeign

func (f *Field) HasForeign() bool

func (*Field) HasHidden

func (f *Field) HasHidden() bool

func (*Field) HasIndex

func (f *Field) HasIndex() bool

func (*Field) HasMeta

func (f *Field) HasMeta() bool

func (*Field) HasReadOnly

func (f *Field) HasReadOnly() bool

func (*Field) HasRule

func (f *Field) HasRule() bool

func (*Field) HasStringList

func (f *Field) HasStringList() bool

func (*Field) IsNullable

func (f *Field) IsNullable() bool

func (*Field) IsNullablePrimitive

func (f *Field) IsNullablePrimitive() bool

func (*Field) IsRequired

func (f *Field) IsRequired() bool

func (*Field) IsUnique

func (f *Field) IsUnique() bool

func (*Field) NullSQLTypeNeedCast

func (f *Field) NullSQLTypeNeedCast() bool

func (*Field) NullSQLTypeValue

func (f *Field) NullSQLTypeValue() string

func (*Field) Read

func (f *Field) Read(data map[interface{}]interface{}) error

type Index

type Index struct {
	Name       string
	Fields     []*Field
	FieldNames []string
	IsUnique   bool
	IsSparse   bool
}

func (*Index) GetFieldList

func (i *Index) GetFieldList() string

func (*Index) GetFuncParam

func (i *Index) GetFuncParam() string

func (*Index) GetFuncParamNames

func (i *Index) GetFuncParamNames() string

type ListedField

type ListedField struct {
	Key      string
	ObjName  string
	ObjField string
}

type Obj

type Obj struct {
	Db           string
	Extend       string
	Fields       []*Field
	FieldNameMap map[string]*Field
	FilterFields []string
	Indexes      []*Index
	Name         string
	Package      string
	SearchIndex  string
	SearchType   string
	Table        string
	TplWriter    io.Writer
	DbName       string
}

func (*Obj) GetConfigTemplate

func (o *Obj) GetConfigTemplate() (string, bool)

func (*Obj) GetFieldNames

func (o *Obj) GetFieldNames() []string

func (*Obj) GetFilterFields

func (o *Obj) GetFilterFields() []*Field

func (*Obj) GetFormImports

func (o *Obj) GetFormImports() (imports []string)

func (*Obj) GetGenTypes

func (o *Obj) GetGenTypes() []string

func (*Obj) GetListedFields

func (o *Obj) GetListedFields() []*ListedField

func (*Obj) GetNonIDFields

func (o *Obj) GetNonIDFields() []*Field

func (*Obj) GetNonIdFieldNames

func (o *Obj) GetNonIdFieldNames() []string

func (*Obj) GetOrmImports

func (o *Obj) GetOrmImports() (imports []string)

func (*Obj) GetStringFilterFields

func (o *Obj) GetStringFilterFields() []*Field

func (*Obj) GetTimeFields

func (o *Obj) GetTimeFields() []*Field

func (*Obj) HasTimeFields

func (o *Obj) HasTimeFields() bool

func (*Obj) LoadField

func (o *Obj) LoadField(f *Field) string

func (*Obj) LoadTpl

func (o *Obj) LoadTpl(tpl string) string

func (*Obj) NeedIndex

func (o *Obj) NeedIndex() bool

func (*Obj) NeedMapping

func (o *Obj) NeedMapping() bool

func (*Obj) NeedOrm

func (o *Obj) NeedOrm() bool

func (*Obj) NeedSearch

func (o *Obj) NeedSearch() bool

func (*Obj) Read

func (o *Obj) Read(data map[string]interface{}) error

Jump to

Keyboard shortcuts

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