Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
Annotation defines key-value
type DefineStruct ¶
DefineStruct describes api structure
func (DefineStruct) GetBodyMembers ¶
func (t DefineStruct) GetBodyMembers() []Member
GetBodyMembers returns all json fields
func (DefineStruct) GetFormMembers ¶
func (t DefineStruct) GetFormMembers() []Member
GetFormMembers returns all form fields
func (DefineStruct) GetNonBodyMembers ¶
func (t DefineStruct) GetNonBodyMembers() []Member
GetNonBodyMembers returns all have no tag fields
func (DefineStruct) Name ¶
func (t DefineStruct) Name() string
Name returns a structure string, such as User
type Group ¶
type Group struct {
Annotation Annotation
Routes []Route
}
Group defines a set of routing information
func (Group) GetAnnotation ¶
GetAnnotation returns the value by specified key from @server
type Info ¶
type Info struct {
// Deprecated: use Properties instead
Title string
// Deprecated: use Properties instead
Desc string
// Deprecated: use Properties instead
Version string
// Deprecated: use Properties instead
Author string
// Deprecated: use Properties instead
Email string
Properties map[string]string
}
Info describes info grammar block
type InterfaceType ¶
type InterfaceType struct {
RawName string
}
InterfaceType describes a interface for api
func (InterfaceType) Name ¶
func (t InterfaceType) Name() string
Name returns a interface string, Its fixed value is interface{}
type MapType ¶
type MapType struct {
RawName string
// only support the PrimitiveType
Key string
// it can be asserted as PrimitiveType: int、bool、
// PointerType: *string、*User、
// MapType: map[${PrimitiveType}]interface、
// ArrayType:[]int、[]User、[]*User
// InterfaceType: interface{}
// Type
Value Type
}
MapType describes a map for api
type Member ¶
type Member struct {
Name string
// 数据类型字面值,如:string、map[int]string、[]int64、[]*User
Type Type
Tag string
Comment string
// 成员头顶注释说明
Docs Doc
IsInline bool
}
Member describes the field of a structure
func (Member) GetComment ¶
GetComment returns comment value of Member
func (Member) GetPropertyName ¶
GetPropertyName returns json tag value
func (Member) IsBodyMember ¶
IsBodyMember returns true if contains json tag
func (Member) IsFormMember ¶
IsFormMember returns true if contains form tag
func (Member) IsOmitEmpty ¶
IsOmitEmpty returns true if tag contains omitempty
func (Member) IsOptional ¶
IsOptional returns true if tag is optional
type OriginType ¶
func (OriginType) Name ¶
func (t OriginType) Name() string
type PointerType ¶
PointerType describes a pointer for api
func (PointerType) Name ¶
func (t PointerType) Name() string
Name returns a pointer string, such as *User
type PrimitiveType ¶
type PrimitiveType struct {
RawName string
}
PrimitiveType describes the basic golang type, such as bool,int32,int64, ...
func (PrimitiveType) Name ¶
func (t PrimitiveType) Name() string
Name returns a basic string, such as int32,int64
type Route ¶
type Route struct {
AtServerAnnotation Annotation
Method string
Path string
RequestType Type
ResponseType Type
Docs Doc
Handler string
AtDoc AtDoc
}
Route describes api route
func (Route) GetAnnotation ¶
GetAnnotation returns the value by specified key from @server
func (Route) RequestTypeName ¶
RequestTypeName returns request type name of route
func (Route) ResponseTypeName ¶
ResponseTypeName returns response type name of route
type Tag ¶
type Tag struct {
// Key is the tag key, such as json, xml, etc..
// i.e: `json:"foo,omitempty". Here key is: "json"
Key string
// Name is a part of the value
// i.e: `json:"foo,omitempty". Here name is: "foo"
Name string
// Options is a part of the value. It contains a slice of tag options i.e:
// `json:"foo,omitempty". Here options is: ["omitempty"]
Options []string
}
Tag defines a tag for structure filed