Documentation ¶
Index ¶
- Constants
- Variables
- type API
- type APIClass
- type APIResponseHelper
- func (h *APIResponseHelper) CreateCollectionMethodDeclare() *MethodDeclare
- func (h *APIResponseHelper) CreateMethodDeclare() *MethodDeclare
- func (h *APIResponseHelper) Field(name string) *code.Statement
- func (h *APIResponseHelper) GetClass() *Class
- func (h *APIResponseHelper) GetImportList() ImportList
- func (h *APIResponseHelper) IsModelPackage() bool
- func (h *APIResponseHelper) MethodCall(name string, args ...code.Code) *code.Statement
- func (h *APIResponseHelper) Package(name string) string
- func (h *APIResponseHelper) Receiver() *code.Statement
- type Attribute
- type Class
- func (c *Class) AllDependencyClasses() []*Class
- func (c *Class) DefaultTestObject() *TestObject
- func (c *Class) DependencyClasses() []*Class
- func (c *Class) DependencyMembers() []*Member
- func (c *Class) ExtendMembers() Members
- func (c *Class) FileName() string
- func (c *Class) Keys() []Members
- func (c *Class) MarshalRelation() ([]byte, error)
- func (c *Class) MemberByName(name string) *Member
- func (c *Class) Merge(schema *Class)
- func (c *Class) PrimaryKey() *Member
- func (c *Class) RelationMembers() Members
- func (c *Class) ResolveTypeReference() error
- func (c *Class) SetClassMap(classMap *map[string]*Class)
- func (c *Class) SetSubClassMap(subClassMap *map[string]*Class)
- func (c *Class) TestData() *TestData
- func (c *Class) UniqueKeys() []Members
- func (c *Class) Validate() error
- type ConstructorDeclare
- type ConstructorParam
- type ConstructorParamArgs
- type CountParam
- type CountParamArgs
- type CreateParam
- type CreateParamArgs
- type DAOContext
- type DataAccessParam
- type DeleteParam
- type DeleteParamArgs
- type EntityMethodHelper
- type FindParam
- type FindParamArgs
- type INDEX
- type ImportDeclare
- type ImportList
- type InType
- type Include
- type Key
- type Member
- func (m *Member) CamelType() string
- func (m *Member) CollectionName() Name
- func (m *Member) IsCollectionType() bool
- func (m *Member) ModelCollectionTypeName(importList ImportList) string
- func (m *Member) RenderNameByProtocol(requiredProtocol string) string
- func (m *Member) RenderProtocols() []string
- func (m *Member) Validate() error
- type Members
- type Method
- type MethodDeclare
- type Methods
- type ModelMethodHelper
- func (h *ModelMethodHelper) CollectionProperties() ValueDeclares
- func (h *ModelMethodHelper) CreateCollectionMethodDeclare() *MethodDeclare
- func (h *ModelMethodHelper) CreateMethodDeclare() *MethodDeclare
- func (h *ModelMethodHelper) CreateMultipleCollectionMethodDeclare() *MethodDeclare
- func (h *ModelMethodHelper) DAO() *code.Statement
- func (h *ModelMethodHelper) DAOName() string
- func (h *ModelMethodHelper) Field(name string) *code.Statement
- func (h *ModelMethodHelper) GetClass() *Class
- func (h *ModelMethodHelper) GetImportList() ImportList
- func (h *ModelMethodHelper) IsModelPackage() bool
- func (h *ModelMethodHelper) MethodCall(name string, args ...code.Code) *code.Statement
- func (h *ModelMethodHelper) ModelCollectionName() string
- func (h *ModelMethodHelper) ModelCollectionType() *TypeDeclare
- func (h *ModelMethodHelper) ModelName() string
- func (h *ModelMethodHelper) ModelType() *TypeDeclare
- func (h *ModelMethodHelper) Package(name string) string
- func (h *ModelMethodHelper) Receiver() *code.Statement
- type Name
- type Relation
- type Render
- type RepositoryMethodHelper
- func (h *RepositoryMethodHelper) ContextType() *TypeDeclare
- func (h *RepositoryMethodHelper) CreateMethodDeclare() *MethodDeclare
- func (h *RepositoryMethodHelper) DAO() *code.Statement
- func (h *RepositoryMethodHelper) DAOName() string
- func (h *RepositoryMethodHelper) EntityClassType() *TypeDeclare
- func (h *RepositoryMethodHelper) EntityCollectionClassType() *TypeDeclare
- func (h *RepositoryMethodHelper) FieldsToFind() code.Dict
- func (h *RepositoryMethodHelper) ModelClassType() *TypeDeclare
- func (h *RepositoryMethodHelper) ModelCollectionClassType() *TypeDeclare
- func (h *RepositoryMethodHelper) Package(name string) string
- func (h *RepositoryMethodHelper) Receiver() *code.Statement
- func (h *RepositoryMethodHelper) ReceiverClassName() string
- type Request
- type RequestParam
- type RequestParams
- type Response
- func (r *Response) Attributes() []*Attribute
- func (r *Response) BuilderCode(h *APIResponseHelper) []code.Code
- func (r *Response) Render() interface{}
- func (r *Response) RenderJSON() string
- func (r *Response) ResolveClassReference(classMap *map[string]*Class, subClassMap *map[string]*Class)
- func (r *Response) UnmarshalYAML(unmarshal func(interface{}) error) error
- type SQL
- type StructFieldList
- type TestData
- type TestObject
- type TestObjectDecl
- type TestObjectMap
- type Type
- type TypeDeclare
- func (d *TypeDeclare) Class() *Class
- func (d *TypeDeclare) Code(importList ImportList) code.Code
- func (d *TypeDeclare) CodePackage(pkg string, importList ImportList) code.Code
- func (d *TypeDeclare) CodeWithoutPackage(importList ImportList) code.Code
- func (d *TypeDeclare) CollectionName(importList ImportList) string
- func (d *TypeDeclare) DefaultValue() interface{}
- func (d *TypeDeclare) FormatName(importList ImportList) string
- func (d *TypeDeclare) IsCustomPrimitiveType() bool
- func (d *TypeDeclare) IsSchemaClass() bool
- func (d *TypeDeclare) MarshalYAML() (interface{}, error)
- func (d *TypeDeclare) Name() string
- func (d *TypeDeclare) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (d *TypeDeclare) ValueToCode(v interface{}) code.Code
- type UniqueKey
- type UpdateParam
- type UpdateParamArgs
- type ValueDeclare
- type ValueDeclares
Constants ¶
View Source
const ( InHeader InType = "header" InPath = "path" InQuery = "query" InBody = "body" )
Variables ¶
View Source
var ( IntType = &Type{Name: "int", IsPrimitive: true, DefaultValue: int(0)} Int8Type = &Type{Name: "int8", IsPrimitive: true, DefaultValue: int8(0)} Int16Type = &Type{Name: "int16", IsPrimitive: true, DefaultValue: int16(0)} Int32Type = &Type{Name: "int32", IsPrimitive: true, DefaultValue: int32(0)} Int64Type = &Type{Name: "int64", IsPrimitive: true, DefaultValue: int64(0)} UintType = &Type{Name: "uint", IsPrimitive: true, DefaultValue: uint(0)} Uint8Type = &Type{Name: "uint8", IsPrimitive: true, DefaultValue: uint8(0)} Uint16Type = &Type{Name: "uint16", IsPrimitive: true, DefaultValue: uint16(0)} Uint32Type = &Type{Name: "uint32", IsPrimitive: true, DefaultValue: uint32(0)} Uint64Type = &Type{Name: "uint64", IsPrimitive: true, DefaultValue: uint64(0)} Float32Type = &Type{Name: "float32", IsPrimitive: true, DefaultValue: float32(0)} Float64Type = &Type{Name: "float64", IsPrimitive: true, DefaultValue: float64(0)} BoolType = &Type{Name: "bool", IsPrimitive: true, DefaultValue: false} StringType = &Type{Name: "string", IsPrimitive: true, DefaultValue: ""} Complex64Type = &Type{Name: "complex64", IsPrimitive: true, DefaultValue: 0} Complex128Type = &Type{Name: "complex128", IsPrimitive: true, DefaultValue: 0} ByteType = &Type{Name: "byte", IsPrimitive: true, DefaultValue: 0} RuneType = &Type{Name: "rune", IsPrimitive: true, DefaultValue: ""} ErrorType = &Type{Name: "error"} PrimitiveTypes = map[string]*Type{ IntType.Name: IntType, Int8Type.Name: Int8Type, Int16Type.Name: Int16Type, Int32Type.Name: Int32Type, Int64Type.Name: Int64Type, UintType.Name: UintType, Uint8Type.Name: Uint8Type, Uint16Type.Name: Uint16Type, Uint32Type.Name: Uint32Type, Uint64Type.Name: Uint64Type, Float32Type.Name: Float32Type, Float64Type.Name: Float64Type, BoolType.Name: BoolType, StringType.Name: StringType, Complex64Type.Name: Complex64Type, Complex128Type.Name: Complex128Type, ByteType.Name: ByteType, RuneType.Name: RuneType, } )
Functions ¶
This section is empty.
Types ¶
type APIResponseHelper ¶
type APIResponseHelper struct { Class *Class ReceiverName string ImportList ImportList }
func (*APIResponseHelper) CreateCollectionMethodDeclare ¶
func (h *APIResponseHelper) CreateCollectionMethodDeclare() *MethodDeclare
func (*APIResponseHelper) CreateMethodDeclare ¶
func (h *APIResponseHelper) CreateMethodDeclare() *MethodDeclare
func (*APIResponseHelper) GetClass ¶
func (h *APIResponseHelper) GetClass() *Class
func (*APIResponseHelper) GetImportList ¶
func (h *APIResponseHelper) GetImportList() ImportList
func (*APIResponseHelper) IsModelPackage ¶
func (h *APIResponseHelper) IsModelPackage() bool
func (*APIResponseHelper) MethodCall ¶
func (*APIResponseHelper) Package ¶
func (h *APIResponseHelper) Package(name string) string
func (*APIResponseHelper) Receiver ¶
func (h *APIResponseHelper) Receiver() *code.Statement
type Class ¶
type Class struct { Name Name `yaml:"name"` DataStore string `yaml:"datastore"` Index *INDEX `yaml:"index"` ReadOnly bool `yaml:"read_only,omitempty"` Members []*Member `yaml:"members"` // contains filtered or unexported fields }
func (*Class) AllDependencyClasses ¶
func (*Class) DefaultTestObject ¶
func (c *Class) DefaultTestObject() *TestObject
func (*Class) DependencyClasses ¶
func (*Class) DependencyMembers ¶
func (*Class) ExtendMembers ¶
func (*Class) MarshalRelation ¶
func (*Class) MemberByName ¶
func (*Class) PrimaryKey ¶
func (*Class) RelationMembers ¶
func (*Class) ResolveTypeReference ¶
func (*Class) SetClassMap ¶
func (*Class) SetSubClassMap ¶
func (*Class) UniqueKeys ¶
type ConstructorDeclare ¶
type ConstructorDeclare struct { Class *Class MethodName string Args ValueDeclares Return ValueDeclares ImportList ImportList }
func (*ConstructorDeclare) MethodInterface ¶
func (d *ConstructorDeclare) MethodInterface(importList ImportList) *code.Statement
func (*ConstructorDeclare) Package ¶
func (d *ConstructorDeclare) Package(name string) string
type ConstructorParam ¶
type ConstructorParam struct { DataAccessParam ImplName string Args *ConstructorParamArgs }
type ConstructorParamArgs ¶
type CountParam ¶
type CountParam struct { DataAccessParam Args *CountParamArgs }
type CountParamArgs ¶
type CreateParam ¶
type CreateParam struct { DataAccessParam Args *CreateParamArgs }
type CreateParamArgs ¶
type DAOContext ¶
type DAOContext interface{}
type DataAccessParam ¶
type DataAccessParam struct { Class *Class ClassName func() *code.Statement Receiver func() *code.Statement ImportList ImportList SQL *SQL }
func (*DataAccessParam) Package ¶
func (p *DataAccessParam) Package(name string) string
type DeleteParam ¶
type DeleteParam struct { DataAccessParam Args *DeleteParamArgs }
type DeleteParamArgs ¶
type EntityMethodHelper ¶
type EntityMethodHelper struct { Class *Class ReceiverName string ImportList ImportList }
func (*EntityMethodHelper) CreateMethodDeclare ¶
func (h *EntityMethodHelper) CreateMethodDeclare() *MethodDeclare
func (*EntityMethodHelper) CreatePluralMethodDeclare ¶
func (h *EntityMethodHelper) CreatePluralMethodDeclare() *MethodDeclare
func (*EntityMethodHelper) Field ¶
func (h *EntityMethodHelper) Field(name string) *Statement
func (*EntityMethodHelper) Package ¶
func (h *EntityMethodHelper) Package(name string) string
type FindParam ¶
type FindParam struct { DataAccessParam Args *FindParamArgs IsSingleReturnValue bool }
type FindParamArgs ¶
type ImportDeclare ¶
func (*ImportDeclare) GetName ¶
func (d *ImportDeclare) GetName() string
func (*ImportDeclare) GetPath ¶
func (d *ImportDeclare) GetPath() string
type ImportList ¶
type ImportList map[string]*ImportDeclare
func DefaultImportList ¶
func DefaultImportList(modulePath string, ctxImportPath string) ImportList
func (ImportList) Each ¶
func (l ImportList) Each(f func(imp code.Import))
func (ImportList) Package ¶
func (l ImportList) Package(name string) string
type Include ¶
type Include struct { Name Name `yaml:"name"` Only []Name `yaml:"only"` Except []Name `yaml:"except"` Include []*Include `yaml:"include"` }
func (*Include) BuilderCode ¶
func (i *Include) BuilderCode(h *APIResponseHelper) code.Code
type Key ¶
type Key struct {
Columns []string
}
func (*Key) MarshalYAML ¶
func (*Key) UnmarshalYAML ¶
type Member ¶
type Member struct { Name Name `yaml:"name"` Type *TypeDeclare `yaml:"type,omitempty"` Extend bool `yaml:"extend,omitempty"` Render *Render `yaml:"render,omitempty"` HasMany bool `yaml:"has_many,omitempty"` Nullable bool `yaml:"nullable,omitempty"` Description string `yaml:"desc,omitempty"` Example interface{} `yaml:"example,omitempty"` Relation *Relation `yaml:"relation,omitempty"` }
func (*Member) CollectionName ¶
func (*Member) IsCollectionType ¶
func (*Member) ModelCollectionTypeName ¶
func (m *Member) ModelCollectionTypeName(importList ImportList) string
func (*Member) RenderNameByProtocol ¶
func (*Member) RenderProtocols ¶
type Method ¶
type Method struct { Decl *MethodDeclare Body []code.Code }
type MethodDeclare ¶
type MethodDeclare struct { Class *Class ReceiverName string ReceiverClassName string ImportList ImportList MethodName string ArgMembers Members Args ValueDeclares Return ValueDeclares IsNotPointerReceiver bool }
func (*MethodDeclare) Interface ¶
func (d *MethodDeclare) Interface(importList ImportList) *code.Statement
func (*MethodDeclare) MethodInterface ¶
func (d *MethodDeclare) MethodInterface(importList ImportList) *code.Statement
type ModelMethodHelper ¶
type ModelMethodHelper struct { Class *Class ReceiverName string ImportList ImportList }
func (*ModelMethodHelper) CollectionProperties ¶
func (h *ModelMethodHelper) CollectionProperties() ValueDeclares
func (*ModelMethodHelper) CreateCollectionMethodDeclare ¶
func (h *ModelMethodHelper) CreateCollectionMethodDeclare() *MethodDeclare
func (*ModelMethodHelper) CreateMethodDeclare ¶
func (h *ModelMethodHelper) CreateMethodDeclare() *MethodDeclare
func (*ModelMethodHelper) CreateMultipleCollectionMethodDeclare ¶
func (h *ModelMethodHelper) CreateMultipleCollectionMethodDeclare() *MethodDeclare
func (*ModelMethodHelper) DAO ¶
func (h *ModelMethodHelper) DAO() *code.Statement
func (*ModelMethodHelper) DAOName ¶
func (h *ModelMethodHelper) DAOName() string
func (*ModelMethodHelper) GetClass ¶
func (h *ModelMethodHelper) GetClass() *Class
func (*ModelMethodHelper) GetImportList ¶
func (h *ModelMethodHelper) GetImportList() ImportList
func (*ModelMethodHelper) IsModelPackage ¶
func (h *ModelMethodHelper) IsModelPackage() bool
func (*ModelMethodHelper) MethodCall ¶
func (*ModelMethodHelper) ModelCollectionName ¶
func (h *ModelMethodHelper) ModelCollectionName() string
func (*ModelMethodHelper) ModelCollectionType ¶
func (h *ModelMethodHelper) ModelCollectionType() *TypeDeclare
func (*ModelMethodHelper) ModelName ¶
func (h *ModelMethodHelper) ModelName() string
func (*ModelMethodHelper) ModelType ¶
func (h *ModelMethodHelper) ModelType() *TypeDeclare
func (*ModelMethodHelper) Package ¶
func (h *ModelMethodHelper) Package(name string) string
func (*ModelMethodHelper) Receiver ¶
func (h *ModelMethodHelper) Receiver() *code.Statement
type Name ¶
type Name string
func (Name) CamelLowerName ¶
func (Name) PluralCamelLowerName ¶
func (Name) PluralCamelName ¶
func (Name) PluralSnakeName ¶
type Relation ¶
type Render ¶
type Render struct { IsRender bool `yaml:"-"` IsInline bool `yaml:"-"` DefaultName string `yaml:"-"` Names map[string]string `yaml:"-"` }
func (*Render) MarshalYAML ¶
MarshalYAML output parameter for render property (1) if IsRender property is true, output the following ``` render: false ``` (2) if IsInline property is true, output the following ``` render:
inline: true
``` (3) if DefaultName property is 'example', output the following ``` render: example ``` (4) if Names property has some keys, output the following ``` render:
json: camelName yaml: snake_name
```
func (*Render) UnmarshalYAML ¶
type RepositoryMethodHelper ¶
type RepositoryMethodHelper struct { AppName string Class *Class ReceiverName string ImportList ImportList }
func (*RepositoryMethodHelper) ContextType ¶
func (h *RepositoryMethodHelper) ContextType() *TypeDeclare
func (*RepositoryMethodHelper) CreateMethodDeclare ¶
func (h *RepositoryMethodHelper) CreateMethodDeclare() *MethodDeclare
func (*RepositoryMethodHelper) DAO ¶
func (h *RepositoryMethodHelper) DAO() *code.Statement
func (*RepositoryMethodHelper) DAOName ¶
func (h *RepositoryMethodHelper) DAOName() string
func (*RepositoryMethodHelper) EntityClassType ¶
func (h *RepositoryMethodHelper) EntityClassType() *TypeDeclare
func (*RepositoryMethodHelper) EntityCollectionClassType ¶
func (h *RepositoryMethodHelper) EntityCollectionClassType() *TypeDeclare
func (*RepositoryMethodHelper) FieldsToFind ¶
func (h *RepositoryMethodHelper) FieldsToFind() code.Dict
func (*RepositoryMethodHelper) ModelClassType ¶
func (h *RepositoryMethodHelper) ModelClassType() *TypeDeclare
func (*RepositoryMethodHelper) ModelCollectionClassType ¶
func (h *RepositoryMethodHelper) ModelCollectionClassType() *TypeDeclare
func (*RepositoryMethodHelper) Package ¶
func (h *RepositoryMethodHelper) Package(name string) string
func (*RepositoryMethodHelper) Receiver ¶
func (h *RepositoryMethodHelper) Receiver() *code.Statement
func (*RepositoryMethodHelper) ReceiverClassName ¶
func (h *RepositoryMethodHelper) ReceiverClassName() string
type Request ¶
type Request struct {
Params RequestParams `yaml:"parameters"`
}
type RequestParam ¶
type RequestParam struct { Name Name `yaml:"name"` Type string `yaml:"type"` In InType `yaml:"in"` Desc string `yaml:"desc"` Example interface{} `yaml:"example"` Render *Render `yaml:"render,omitempty"` Required bool `yaml:"required"` }
func (*RequestParam) RenderName ¶
func (p *RequestParam) RenderName() string
type RequestParams ¶
type RequestParams []*RequestParam
func (RequestParams) HasInBodyParam ¶
func (r RequestParams) HasInBodyParam() bool
func (RequestParams) HasInQueryParam ¶
func (r RequestParams) HasInQueryParam() bool
type Response ¶
func (*Response) Attributes ¶
func (*Response) BuilderCode ¶
func (r *Response) BuilderCode(h *APIResponseHelper) []code.Code
func (*Response) RenderJSON ¶
func (*Response) ResolveClassReference ¶
func (*Response) UnmarshalYAML ¶
type StructFieldList ¶
type StructFieldList map[string]*ValueDeclare
type TestData ¶
type TestData struct { Single TestObjectMap `yaml:"single"` Collection map[string][]*TestObject `yaml:"collection"` }
func (*TestData) MergeDefault ¶
type TestObject ¶
type TestObject struct { *TestObject `yaml:",omitempty,inline,alias"` MapValue map[string]interface{} `yaml:",omitempty,inline"` }
func (*TestObject) MergedMapValue ¶
func (o *TestObject) MergedMapValue() map[string]interface{}
type TestObjectDecl ¶
type TestObjectDecl struct { Name string `yaml:"-"` *TestObject `yaml:",inline,anchor"` }
type TestObjectMap ¶
type TestObjectMap map[string]*TestObject
func (TestObjectMap) MarshalYAML ¶
func (m TestObjectMap) MarshalYAML() (interface{}, error)
type Type ¶
type TypeDeclare ¶
type TypeDeclare struct { Type *Type IsPointer bool IsSlice bool // contains filtered or unexported fields }
func TypeDeclareWithName ¶
func TypeDeclareWithName(name string) *TypeDeclare
func TypeDeclareWithType ¶
func TypeDeclareWithType(typ *Type) *TypeDeclare
func (*TypeDeclare) Class ¶
func (d *TypeDeclare) Class() *Class
func (*TypeDeclare) Code ¶
func (d *TypeDeclare) Code(importList ImportList) code.Code
func (*TypeDeclare) CodePackage ¶
func (d *TypeDeclare) CodePackage(pkg string, importList ImportList) code.Code
func (*TypeDeclare) CodeWithoutPackage ¶
func (d *TypeDeclare) CodeWithoutPackage(importList ImportList) code.Code
func (*TypeDeclare) CollectionName ¶
func (d *TypeDeclare) CollectionName(importList ImportList) string
func (*TypeDeclare) DefaultValue ¶
func (d *TypeDeclare) DefaultValue() interface{}
func (*TypeDeclare) FormatName ¶
func (d *TypeDeclare) FormatName(importList ImportList) string
func (*TypeDeclare) IsCustomPrimitiveType ¶
func (d *TypeDeclare) IsCustomPrimitiveType() bool
func (*TypeDeclare) IsSchemaClass ¶
func (d *TypeDeclare) IsSchemaClass() bool
func (*TypeDeclare) MarshalYAML ¶
func (d *TypeDeclare) MarshalYAML() (interface{}, error)
func (*TypeDeclare) Name ¶
func (d *TypeDeclare) Name() string
func (*TypeDeclare) UnmarshalYAML ¶
func (d *TypeDeclare) UnmarshalYAML(unmarshal func(interface{}) error) error
func (*TypeDeclare) ValueToCode ¶
func (d *TypeDeclare) ValueToCode(v interface{}) code.Code
type UniqueKey ¶
type UniqueKey struct {
Columns []string
}
func (*UniqueKey) MarshalYAML ¶
func (*UniqueKey) UnmarshalYAML ¶
type UpdateParam ¶
type UpdateParam struct { DataAccessParam Args *UpdateParamArgs }
type UpdateParamArgs ¶
type ValueDeclare ¶
type ValueDeclare struct { Name string Type *TypeDeclare }
func (*ValueDeclare) Code ¶
func (d *ValueDeclare) Code(importList ImportList) code.Code
func (*ValueDeclare) Interface ¶
func (d *ValueDeclare) Interface(importList ImportList) code.Code
type ValueDeclares ¶
type ValueDeclares []*ValueDeclare
func (ValueDeclares) Code ¶
func (d ValueDeclares) Code(importList ImportList) []code.Code
func (ValueDeclares) Interface ¶
func (d ValueDeclares) Interface(importList ImportList) []code.Code
Click to show internal directories.
Click to hide internal directories.