spec

package
v1.1.2-0...-c797b3a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	Name       string
	Properties map[string]string
	Value      string
}

type ApiSpec

type ApiSpec struct {
	Info    Info
	Types   []Type
	Service Service
}

func (*ApiSpec) ContainsTime

func (spec *ApiSpec) ContainsTime() bool

type ArrayType

type ArrayType struct {
	StringExpr string
	// it can be asserted as BasicType: int、bool、
	// PointerType: *string、*User、
	// MapType: map[${BasicType}]interface、
	// ArrayType:[]int、[]User、[]*User
	// InterfaceType: interface{}
	// Type
	ArrayType interface{}
}

type BasicType

type BasicType struct {
	StringExpr string
	Name       string
}

系统预设基本数据类型

type Group

type Group struct {
	Annotations []Annotation
	Routes      []Route
}

type Info

type Info struct {
	Title   string
	Desc    string
	Version string
	Author  string
	Email   string
}

type InterfaceType

type InterfaceType struct {
	StringExpr string
}

type MapType

type MapType struct {
	StringExpr string
	// only support the BasicType
	Key string
	// it can be asserted as BasicType: int、bool、
	// PointerType: *string、*User、
	// MapType: map[${BasicType}]interface、
	// ArrayType:[]int、[]User、[]*User
	// InterfaceType: interface{}
	// Type
	Value interface{}
}

type Member

type Member struct {
	Annotations []Annotation
	Name        string
	// 数据类型字面值,如:string、map[int]string、[]int64、[]*User
	Type string
	// it can be asserted as BasicType: int、bool、
	// PointerType: *string、*User、
	// MapType: map[${BasicType}]interface、
	// ArrayType:[]int、[]User、[]*User
	// InterfaceType: interface{}
	// Type
	Expr interface{}
	Tag  string
	// Deprecated
	Comment string // 换成标准struct中将废弃
	// 成员尾部注释说明
	Comments []string
	// 成员头顶注释说明
	Docs     []string
	IsInline bool
}

func (Member) GetComment

func (m Member) GetComment() string

func (Member) GetPropertyName

func (m Member) GetPropertyName() (string, error)

func (Member) IsBodyMember

func (m Member) IsBodyMember() bool

func (Member) IsOmitempty

func (m Member) IsOmitempty() bool

func (Member) IsOptional

func (m Member) IsOptional() bool

func (Member) Tags

func (m Member) Tags() []*Tag

type PointerType

type PointerType struct {
	StringExpr string
	// it can be asserted as BasicType: int、bool、
	// PointerType: *string、*User、
	// MapType: map[${BasicType}]interface、
	// ArrayType:[]int、[]User、[]*User
	// InterfaceType: interface{}
	// Type
	Star interface{}
}

type Route

type Route struct {
	Annotations  []Annotation
	Method       string
	Path         string
	RequestType  Type
	ResponseType Type
}

type Service

type Service struct {
	Name   string
	Groups []Group
}

func (Service) Routes

func (s Service) Routes() []Route

type StructType

type StructType struct {
	StringExpr string
}

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
}

type Tags

type Tags struct {
	// contains filtered or unexported fields
}

func Parse

func Parse(tag string) (*Tags, error)

func (*Tags) Get

func (t *Tags) Get(key string) (*Tag, error)

func (*Tags) Keys

func (t *Tags) Keys() []string

func (*Tags) Tags

func (t *Tags) Tags() []*Tag

type TimeType

type TimeType struct {
	StringExpr string
}

type Type

type Type struct {
	Name        string
	Annotations []Annotation
	Members     []Member
}

func (Type) GetBodyMembers

func (t Type) GetBodyMembers() []Member

func (Type) GetNonBodyMembers

func (t Type) GetNonBodyMembers() []Member

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL