go-zero/tools/goctl/api/spec/spec.go

119 lines
1.9 KiB
Go
Raw Normal View History

2020-07-29 17:11:41 +08:00
package spec
type (
Doc []string
2020-07-29 17:11:41 +08:00
Annotation struct {
Properties map[string]string
}
ApiSyntax struct {
Version string
2020-07-29 17:11:41 +08:00
}
ApiSpec struct {
Info Info
Syntax ApiSyntax
Imports []Import
2020-07-29 17:11:41 +08:00
Types []Type
Service Service
}
Import struct {
Value string
}
2020-07-29 17:11:41 +08:00
Group struct {
Annotation Annotation
Routes []Route
2020-07-29 17:11:41 +08:00
}
Info struct {
// Deprecated: use Properties instead
Title string
// Deprecated: use Properties instead
Desc string
// Deprecated: use Properties instead
2020-07-29 17:11:41 +08:00
Version string
// Deprecated: use Properties instead
Author string
// Deprecated: use Properties instead
Email string
Properties map[string]string
2020-07-29 17:11:41 +08:00
}
Member struct {
Name string
2020-07-29 17:11:41 +08:00
// 数据类型字面值string、map[int]string、[]int64、[]*User
Type Type
Tag string
Comment string
2020-07-29 17:11:41 +08:00
// 成员头顶注释说明
Docs Doc
2020-07-29 17:11:41 +08:00
IsInline bool
}
Route struct {
Annotation Annotation
2020-07-29 17:11:41 +08:00
Method string
Path string
RequestType Type
ResponseType Type
Docs Doc
Handler string
AtDoc AtDoc
2020-07-29 17:11:41 +08:00
}
Service struct {
Name string
Groups []Group
2020-07-29 17:11:41 +08:00
}
Type interface {
Name() string
2020-07-29 17:11:41 +08:00
}
DefineStruct struct {
RawName string
Members []Member
Docs Doc
2020-07-29 17:11:41 +08:00
}
// 系统预设基本数据类型 bool int32 int64 float32
PrimitiveType struct {
RawName string
2020-07-29 17:11:41 +08:00
}
MapType struct {
RawName string
// only support the PrimitiveType
2020-07-29 17:11:41 +08:00
Key string
// it can be asserted as PrimitiveType: int、bool、
2020-07-29 17:11:41 +08:00
// PointerType: *string、*User、
// MapType: map[${PrimitiveType}]interface、
2020-07-29 17:11:41 +08:00
// ArrayType:[]int、[]User、[]*User
// InterfaceType: interface{}
// Type
Value Type
2020-07-29 17:11:41 +08:00
}
2020-07-29 17:11:41 +08:00
ArrayType struct {
RawName string
Value Type
2020-07-29 17:11:41 +08:00
}
2020-07-29 17:11:41 +08:00
InterfaceType struct {
RawName string
2020-07-29 17:11:41 +08:00
}
PointerType struct {
RawName string
Type Type
2020-07-29 17:11:41 +08:00
}
AtDoc struct {
Properties map[string]string
Text string
}
2020-07-29 17:11:41 +08:00
)