Documentation ¶
Index ¶
- func DocsFromCommentGroup(cg *ast.CommentGroup) string
- type ArrayType
- type CopyIntoStruct
- type EnumType
- type ExcludeField
- type ExcludeImport
- type ExcludeType
- type Field
- type File
- type GenEnumTypeTransform
- type GenFieldTransform
- type Import
- type MapType
- type ModifyField
- type ModifyImport
- type ModifyType
- type Node
- type Option
- type PlainType
- type PromoteToEnumType
- type StructType
- type Transform
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DocsFromCommentGroup ¶
func DocsFromCommentGroup(cg *ast.CommentGroup) string
Types ¶
type ArrayType ¶
type ArrayType struct { Name string `json:"name"` Type string `json:"type"` Length int `json:"length,omitempty"` Docs string `json:"-"` }
func (*ArrayType) GetTypeNames ¶
func (*ArrayType) Reflect ¶
func (a *ArrayType) Reflect() json.RawMessage
func (*ArrayType) SetTypeNames ¶
type CopyIntoStruct ¶
type EnumType ¶
type EnumType struct { Name string `json:"name"` Values []string `json:"values"` Docs string `json:"-"` }
func (*EnumType) GetTypeNames ¶
func (*EnumType) Reflect ¶
func (et *EnumType) Reflect() json.RawMessage
func (*EnumType) SetTypeNames ¶
type ExcludeField ¶
type ExcludeImport ¶
type ExcludeType ¶
type File ¶
type File struct { Imports map[string]Import Code []Type // contains filtered or unexported fields }
func (*File) Reflect ¶
func (f *File) Reflect() json.RawMessage
type GenEnumTypeTransform ¶
type GenEnumTypeTransform struct {
Generate func(string, *ast.ValueSpec) *PromoteToEnumType
}
type GenFieldTransform ¶
type GenFieldTransform struct {
Generate func(*StructType, *Field) Transform
}
type Import ¶
type Import struct { Name string `json:"name,omitempty"` Path string `json:"path"` // contains filtered or unexported fields }
func ImportFromSpec ¶
func ImportFromSpec(spec *ast.ImportSpec) Import
func (*Import) GetOldPath ¶
func (*Import) Reflect ¶
func (i *Import) Reflect() json.RawMessage
type MapType ¶
type MapType struct { Name string `json:"name"` KeyType string `json:"key_type"` ValueType string `json:"value_type"` Docs string `json:"-"` }
func (*MapType) GetTypeNames ¶
func (*MapType) Reflect ¶
func (m *MapType) Reflect() json.RawMessage
func (*MapType) SetTypeNames ¶
type ModifyField ¶
type ModifyImport ¶
type ModifyType ¶
type Node ¶
type Node interface { // Renders JSON representation of the node. Reflect() json.RawMessage // Renders Go type definitions. Go() string // Renders CUE definitions. CUE() string }
type Option ¶
type Option func(*File)
func WithCUEPackageName ¶
func WithPackageName ¶
func WithTransform ¶
type PlainType ¶
type PlainType struct { Name string `json:"name"` Type string `json:"type"` Docs string `json:"-"` }
func PlainTypeFromSelectorExpr ¶
func PlainTypeFromSelectorExpr(name, docs string, s *ast.SelectorExpr) *PlainType
func PlainTypeFromStarExpr ¶
func (*PlainType) GetTypeNames ¶
func (*PlainType) Reflect ¶
func (p *PlainType) Reflect() json.RawMessage
func (*PlainType) SetTypeNames ¶
type PromoteToEnumType ¶
type StructType ¶
type StructType struct { Name string `json:"name"` Fields []*Field `json:"fields"` Docs string `json:"-"` }
func StructTypeFromSpec ¶
func StructTypeFromSpec(name, docs string, s *ast.StructType) (*StructType, error)
func (*StructType) CUE ¶
func (s *StructType) CUE() string
func (*StructType) GetDocs ¶
func (s *StructType) GetDocs() string
func (*StructType) GetName ¶
func (s *StructType) GetName() string
func (*StructType) GetTypeNames ¶
func (s *StructType) GetTypeNames() []string
func (*StructType) Go ¶
func (s *StructType) Go() string
func (*StructType) Reflect ¶
func (s *StructType) Reflect() json.RawMessage
func (*StructType) SetTypeNames ¶
func (s *StructType) SetTypeNames(tt []string)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.