You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zero/tools/goctl/api/spec/spec.go

119 lines
1.9 KiB
Go

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