Documentation ¶
Index ¶
- type ArrayType
- type Coder
- type ConstantField
- type ConstantFields
- type ExternalType
- type File
- type Function
- type Import
- type InterfaceSpec
- type InterfaceSpecs
- type MapType
- type Method
- type Option
- type Options
- type Param
- type PointerType
- type Receiver
- type SimpleType
- type Struct
- type StructField
- type StructFields
- type Structs
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConstantField ¶
type ConstantFields ¶
type ConstantFields []*ConstantField
type ExternalType ¶
ExternalType is a type that is called to another package
func (ExternalType) Code ¶
func (t ExternalType) Code() string
Code returns token string in code format
type File ¶
type File struct { PackageName string Imports []*Import Structs Structs Interfaces InterfaceSpecs Methods []*Method Constants ConstantFields }
File is a container of all required components for code generation in the file
func ExportFile ¶
func ExtractComponents ¶
ExtractComponents converts ast file into code components model
type Import ¶
Import is a model for package imports
func ExtraImports ¶
func ExtraImports(spec *ast.ImportSpec) *Import
type InterfaceSpec ¶
InterfaceSpec is a definition of the interface
func ExtractInterfaceSpec ¶
func ExtractInterfaceSpec(spec *ast.TypeSpec, iType *ast.InterfaceType) *InterfaceSpec
type InterfaceSpecs ¶
type InterfaceSpecs []*InterfaceSpec
InterfaceSpecs is a group of InterfaceSpec model
func (InterfaceSpecs) ByName ¶
func (intfs InterfaceSpecs) ByName(name string) (*InterfaceSpec, bool)
ByName return interface by name Another return value shows whether there is an interface with that name exists.
type Method ¶
func ExtractMethod ¶
type Option ¶
type Option interface {
Apply(*Options)
}
func WithConstants ¶
func WithConstants() Option
func WithFunctions ¶
func WithFunctions() Option
func WithImports ¶
func WithImports() Option
func WithInterfaces ¶
func WithInterfaces() Option
func WithStructs ¶
func WithStructs() Option
type Options ¶
type Options struct { ExtraImports bool ExtraConstants bool ExtraStructs bool ExtraInterfaces bool ExtraFunctions bool }
func NewOptions ¶
type PointerType ¶
type PointerType struct {
ContainedType Type
}
PointerType is a model of pointer
func (PointerType) Code ¶
func (t PointerType) Code() string
Code returns token string in code format
type SimpleType ¶
type SimpleType string
SimpleType is a type that can be called directly
func (SimpleType) IsBuildIn ¶
func (t SimpleType) IsBuildIn() bool
type Struct ¶
type Struct struct { PackageAlias string Name string Fields StructFields }
Struct is a definition of the struct
func (Struct) ReferencedType ¶
ReferencedType returns a type variable of this struct
type StructField ¶
StructField is a definition of the struct field
type StructFields ¶
type StructFields []StructField
StructFields is a group of the StructField model
func (StructFields) ByName ¶
func (fields StructFields) ByName(name string) (StructField, bool)
ByName return struct field with matching name