Documentation ¶
Index ¶
- Variables
- func IsBaseType(typ *Type) bool
- type BoolExpression
- type Category
- type Choice
- type Constant
- type DoubleExpression
- type Enum
- type Field
- type Function
- type IntExpression
- type Kind
- type ListExpression
- type Literal
- type MapExpression
- type Method
- type Model
- type Models
- type NumberExpression
- type Oneof
- type RequiredNess
- type StringExpression
- type Struct
- type Tag
- type Tags
- type Type
- type TypeDef
- type Variable
Constants ¶
This section is empty.
Variables ¶
View Source
var ( BaseTypes = []*Type{TypeBool, TypeByte, TypeInt8, TypeInt16, TypeInt32, TypeInt64, TypeUint8, TypeUint16, TypeUint32, TypeUint64, TypeFloat64, TypeString, TypeBinary} ContainerTypes = []*Type{TypeBaseList, TypeBaseMap, TypeBaseSet} BaseModel = Model{} )
View Source
var ( TypeBool = &Type{ Name: "bool", Scope: &BaseModel, Kind: KindBool, } TypeByte = &Type{ Name: "int8", Scope: &BaseModel, Kind: KindInt8, } TypePbByte = &Type{ Name: "byte", Scope: &BaseModel, Kind: KindInt8, } TypeUint8 = &Type{ Name: "uint8", Scope: &BaseModel, Kind: KindInt8, } TypeUint16 = &Type{ Name: "uint16", Scope: &BaseModel, Kind: KindInt16, } TypeUint32 = &Type{ Name: "uint32", Scope: &BaseModel, Kind: KindInt32, } TypeUint64 = &Type{ Name: "uint64", Scope: &BaseModel, Kind: KindInt64, } TypeUint = &Type{ Name: "uint", Scope: &BaseModel, Kind: KindInt, } TypeInt8 = &Type{ Name: "int8", Scope: &BaseModel, Kind: KindInt8, } TypeInt16 = &Type{ Name: "int16", Scope: &BaseModel, Kind: KindInt16, } TypeInt32 = &Type{ Name: "int32", Scope: &BaseModel, Kind: KindInt32, } TypeInt64 = &Type{ Name: "int64", Scope: &BaseModel, Kind: KindInt64, } TypeInt = &Type{ Name: "int", Scope: &BaseModel, Kind: KindInt, } TypeFloat32 = &Type{ Name: "float32", Scope: &BaseModel, Kind: KindFloat64, } TypeFloat64 = &Type{ Name: "float64", Scope: &BaseModel, Kind: KindFloat64, } TypeString = &Type{ Name: "string", Scope: &BaseModel, Kind: KindString, } TypeBinary = &Type{ Name: "binary", Scope: &BaseModel, Kind: KindSlice, Category: CategoryBinary, Extra: []*Type{TypePbByte}, } TypeBaseMap = &Type{ Name: "map", Scope: &BaseModel, Kind: KindMap, Category: CategoryMap, } TypeBaseSet = &Type{ Name: "set", Scope: &BaseModel, Kind: KindSlice, Category: CategorySet, } TypeBaseList = &Type{ Name: "list", Scope: &BaseModel, Kind: KindSlice, Category: CategoryList, } )
Functions ¶
func IsBaseType ¶
Types ¶
type BoolExpression ¶
type BoolExpression struct {
Src bool
}
func (BoolExpression) Expression ¶
func (boolExpr BoolExpression) Expression() string
type Category ¶
type Category int64
const ( CategoryConstant Category = 1 CategoryBinary Category = 8 CategoryMap Category = 9 CategoryList Category = 10 CategorySet Category = 11 CategoryEnum Category = 12 CategoryStruct Category = 13 CategoryUnion Category = 14 CategoryException Category = 15 CategoryTypedef Category = 16 CategoryService Category = 17 )
type DoubleExpression ¶
type DoubleExpression struct {
Src float64
}
func (DoubleExpression) Expression ¶
func (doubleExpr DoubleExpression) Expression() string
type Field ¶
type IntExpression ¶
type IntExpression struct {
Src int
}
func (IntExpression) Expression ¶
func (intExpr IntExpression) Expression() string
type Kind ¶
type Kind uint
const ( KindInvalid Kind = iota KindBool KindInt KindInt8 KindInt16 KindInt32 KindInt64 KindUint KindUint8 KindUint16 KindUint32 KindUint64 KindUintptr KindFloat32 KindFloat64 KindComplex64 KindComplex128 KindArray KindChan KindFunc KindInterface KindMap KindPtr KindSlice KindString KindStruct KindUnsafePointer )
type ListExpression ¶
func (ListExpression) Expression ¶
func (listExpr ListExpression) Expression() string
type MapExpression ¶
func (MapExpression) Expression ¶
func (mapExpr MapExpression) Expression() string
type Model ¶
type Model struct { FilePath string Package string Imports map[string]*Model //{{import}}:Model // rendering data PackageName string // Imports map[string]string //{{alias}}:{{import}} Typedefs []TypeDef Constants []Constant Variables []Variable Functions []Function Enums []Enum Structs []Struct Methods []Method Oneofs []Oneof }
type NumberExpression ¶
type NumberExpression struct {
Src string
}
func (NumberExpression) Expression ¶
func (numExpr NumberExpression) Expression() string
type RequiredNess ¶
type RequiredNess int
const ( RequiredNess_Default RequiredNess = 0 RequiredNess_Required RequiredNess = 1 RequiredNess_Optional RequiredNess = 2 )
type StringExpression ¶
type StringExpression struct {
Src string
}
func (StringExpression) Expression ¶
func (stringExpr StringExpression) Expression() string
type Type ¶
type Type struct { Name string Scope *Model Kind Kind Indirect bool Category Category Extra []*Type // [{key_type},{value_type}] for map, [{element_type}] for list or set HasNew bool }
func NewCategoryType ¶
func NewEnumType ¶
func NewFuncType ¶
func NewOneofType ¶
func NewStructType ¶
func (*Type) IsBaseType ¶
func (*Type) IsSettable ¶
func (*Type) ResolveDefaultValue ¶
Click to show internal directories.
Click to hide internal directories.