Documentation ¶
Overview ¶
Package model contains models to pass data between analyzer and printer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TypesKindToArgumentKind = map[types.BasicKind]ArgumentKind{ types.Bool: ArgumentKindBool, types.Int: ArgumentKindInt, types.Int8: ArgumentKindInt8, types.Int16: ArgumentKindInt16, types.Int32: ArgumentKindInt32, types.Int64: ArgumentKindInt64, types.Uint: ArgumentKindUint, types.Uint8: ArgumentKindUint8, types.Uint16: ArgumentKindUint16, types.Uint32: ArgumentKindUint32, types.Uint64: ArgumentKindUint64, types.Float32: ArgumentKindFloat32, types.Float64: ArgumentKindFloat64, types.String: ArgumentKindString, }
TypesKindToArgumentKind converts go.types basic kind to ArgumentKind.
Functions ¶
This section is empty.
Types ¶
type Argument ¶
type Argument struct { PointerElement *Argument // Type has a star (pointer) to the type. NamedImport string // Path of the package with declarated named type. NamedName string // Name of the named type. NamedComment string // Comments of the NamedObject. NamedObject *Argument // Unwrapped argument of the named type. EnumBasicKind ArgumentKind // Basic type of the Enum (named type). EnumElements []*Argument // List of values with comments of the enum. EnumElementName string // Name of the enum element. EnumElementValue string // Value of the enum element. EnumElementComment string // Comment of the enum element. StructFields []*Argument // List of the struct's fields. StructFieldName string // Name of the struct's field in json. StructFieldGoName string // Origin name of the struct's field. StructFieldComment string // Comment of the struct's field. StructFieldIsOptional bool // Filed of the struct has omitempty json tag. StructFieldIsDeprecated bool // Filed of the struct has deprecated tag mark. SliceElement *Argument // Element of the slice. MapKey *Argument // Key of the map. MapElem *Argument // Element of the map. BasicKind ArgumentKind // Basic type of the argument. BasicFormat ArgumentFormat // Additional format of the argument. IsEmptyInterface bool // Argument is an empty interface or any (1.18). }
Argument of the method Parameter or Result.
func (*Argument) IsAny ¶ added in v0.0.2
IsAny returns true when argument is an empty interface or any.
any or any.
func (*Argument) IsBasic ¶
IsBasic returns true when the argument is a Basic type.
int, string, float64, ...
func (*Argument) IsMap ¶ added in v0.0.2
IsMap returns true when argument is a Map.
map[string]*Type
func (*Argument) IsNamed ¶
IsNamed returns true when the argument is a Named Type.
type NamedType struct {
func (*Argument) IsPointer ¶
IsPointer returns true when the argument is a Pointer to type.
func(a *SomeType)
type ArgumentFormat ¶ added in v0.0.2
type ArgumentFormat string
ArgumentFormat additional format of the argument.
const ( // ArgumentFormatTime means time.Time type. ArgumentFormatTime ArgumentFormat = "date-time" // ArgumentFormatUUID means UUID string type. ArgumentFormatUUID ArgumentFormat = "uuid" )
type ArgumentKind ¶
type ArgumentKind int
ArgumentKind describes the kind of basic type.
const ( ArgumentKindInvalid ArgumentKind = iota ArgumentKindBool ArgumentKindInt ArgumentKindInt8 ArgumentKindInt16 ArgumentKindInt32 ArgumentKindInt64 ArgumentKindUint ArgumentKindUint8 ArgumentKindUint16 ArgumentKindUint32 ArgumentKindUint64 ArgumentKindFloat32 ArgumentKindFloat64 ArgumentKindString )
List of the kinds.
func GetArgumentKind ¶
func GetArgumentKind(text string) ArgumentKind
GetArgumentKind returns ArgumentKind using on text name.
func (ArgumentKind) String ¶
func (ak ArgumentKind) String() string
String converts int value to string name.
type Method ¶
type Method struct { Name string // Name for code generator (snake case of the GoName or special name from comments). GoName string // Name of the methos in the go source file. Comments string // Comments of the method from go source file. SwaggerTags []string // List of the tags in swagger spec. Parameter *Argument // Parameter of the method. Result *Argument // Result of the method. IsDeprecated bool // Method marked as deprecated. IsNotification bool // Method is a Notification. }
Method method of the rpc service. Contains name of the method and arguments and result parameters.
type Service ¶
type Service struct { Import string // Path of the package with interface. PkgName string // Name of the package with interface. Name string // Name for code generator (snake case of the GoName). GoName string // Name of the interface from go source file. Comments string // Comments of the service from go source file. Methods []*Method // List of the methods. ErrorData *Argument // Model for "data" field in the JSON-RPC error. }
Service is an interface in source code that describe rpc service. Interface contains methods and arguments with golang types.