Documentation ¶
Index ¶
- Variables
- func DashCase(s string) string
- func GetModifiedDate(file string) (time.Time, error)
- func GoFmt(filePath string, buf *bytes.Buffer) error
- func LowerFirstWord(s string) string
- func MakeMap(v ...interface{}) map[string]interface{}
- func Natural(name string) string
- func ReadMap[V any](f *FileReader, files []string, recordFile func(string, V)) (map[string]V, error)
- func ReadRaw[V any](files []string, recordFile func(string, V)) (map[string]V, error)
- func TitleCase(s string) string
- func UnderscoreUpperCase(s string) string
- func WriteFile(file string, buf *bytes.Buffer) error
- type API
- type ChainRecord
- func (r *ChainRecord) FullName() string
- func (r *ChainRecord) GetName() string
- func (r *ChainRecord) GetParameters() []*Field
- func (r *ChainRecord) GetParent() *EntityRecord
- func (v *ChainRecord) MarshalJSON() ([]byte, error)
- func (*ChainRecord) Type() RecordType
- func (v *ChainRecord) UnmarshalJSON(data []byte) error
- type CollectionType
- type EntityRecord
- func (r *EntityRecord) FullName() string
- func (r *EntityRecord) GetName() string
- func (r *EntityRecord) GetParameters() []*Field
- func (r *EntityRecord) GetParent() *EntityRecord
- func (v *EntityRecord) MarshalJSON() ([]byte, error)
- func (*EntityRecord) Type() RecordType
- func (v *EntityRecord) UnmarshalJSON(data []byte) error
- type Enum
- type EnumValue
- type Field
- type FieldType
- func (f *FieldType) Equal(g *FieldType) bool
- func (f FieldType) GoType() string
- func (f *FieldType) IsKnown() bool
- func (f FieldType) JavaType() string
- func (f FieldType) MarshalJSON() ([]byte, error)
- func (f FieldType) MarshalYAML() (interface{}, error)
- func (f *FieldType) SetKnown(code TypeCode)
- func (f *FieldType) SetNamed(name string)
- func (f FieldType) String() string
- func (f *FieldType) Title() string
- func (f FieldType) TypescriptInputType(args bool) string
- func (f FieldType) TypescriptType(args bool) string
- func (f *FieldType) UnmarshalJSON(data []byte) error
- func (f *FieldType) UnmarshalYAML(value *yaml.Node) error
- type FileReader
- type IndexRecord
- func (r *IndexRecord) CollectionType() CollectionType
- func (r *IndexRecord) FullName() string
- func (r *IndexRecord) GetDataType() FieldType
- func (r *IndexRecord) GetName() string
- func (r *IndexRecord) GetParameters() []*Field
- func (r *IndexRecord) GetParent() *EntityRecord
- func (r *IndexRecord) IsCounted() bool
- func (r *IndexRecord) IsList() bool
- func (r *IndexRecord) IsPointer() bool
- func (r *IndexRecord) IsSet() bool
- func (r *IndexRecord) IsUnion() bool
- func (v *IndexRecord) MarshalJSON() ([]byte, error)
- func (*IndexRecord) Type() RecordType
- func (v *IndexRecord) UnmarshalJSON(data []byte) error
- func (r *IndexRecord) Wrapped() bool
- type MarshalAs
- func (v MarshalAs) GetEnumValue() uint64
- func (v MarshalAs) MarshalJSON() ([]byte, error)
- func (m *MarshalAs) MarshalYAML() (interface{}, error)
- func (v *MarshalAs) SetEnumValue(id uint64) bool
- func (v MarshalAs) String() string
- func (v *MarshalAs) UnmarshalJSON(data []byte) error
- func (m *MarshalAs) UnmarshalYAML(value *yaml.Node) error
- type Method
- type OtherRecord
- func (r *OtherRecord) FullName() string
- func (r *OtherRecord) GetName() string
- func (r *OtherRecord) GetParameters() []*Field
- func (r *OtherRecord) GetParent() *EntityRecord
- func (v *OtherRecord) MarshalJSON() ([]byte, error)
- func (*OtherRecord) Type() RecordType
- func (v *OtherRecord) UnmarshalJSON(data []byte) error
- type Record
- type RecordBase
- type RecordType
- func (v RecordType) GetEnumValue() uint64
- func (t RecordType) IsChain() bool
- func (t RecordType) IsEntity() bool
- func (t RecordType) IsIndex() bool
- func (t RecordType) IsOther() bool
- func (t RecordType) IsState() bool
- func (v RecordType) MarshalJSON() ([]byte, error)
- func (v *RecordType) SetEnumValue(id uint64) bool
- func (v RecordType) String() string
- func (v *RecordType) UnmarshalJSON(data []byte) error
- type StateRecord
- func (r *StateRecord) CollectionType() CollectionType
- func (r *StateRecord) FullName() string
- func (r *StateRecord) GetDataType() FieldType
- func (r *StateRecord) GetName() string
- func (r *StateRecord) GetParameters() []*Field
- func (r *StateRecord) GetParent() *EntityRecord
- func (r *StateRecord) IsCounted() bool
- func (r *StateRecord) IsList() bool
- func (r *StateRecord) IsPointer() bool
- func (r *StateRecord) IsSet() bool
- func (r *StateRecord) IsUnion() bool
- func (v *StateRecord) MarshalJSON() ([]byte, error)
- func (*StateRecord) Type() RecordType
- func (v *StateRecord) UnmarshalJSON(data []byte) error
- func (r *StateRecord) Wrapped() bool
- type TemplateLibrary
- func (lib *TemplateLibrary) Execute(w io.Writer, name string, data interface{}) error
- func (lib *TemplateLibrary) Parse(src, name string, funcs template.FuncMap) (*template.Template, error)
- func (lib *TemplateLibrary) Register(src, name string, funcs template.FuncMap, altNames ...string) *template.Template
- type Type
- type TypeCode
- func (v TypeCode) GetEnumValue() uint64
- func (t TypeCode) GoType() string
- func (v TypeCode) MarshalJSON() ([]byte, error)
- func (f TypeCode) MarshalYAML() (interface{}, error)
- func (v *TypeCode) SetEnumValue(id uint64) bool
- func (v TypeCode) String() string
- func (t TypeCode) Title() string
- func (t TypeCode) TypescriptInputType() string
- func (t TypeCode) TypescriptType() string
- func (v *TypeCode) UnmarshalJSON(data []byte) error
- func (f *TypeCode) UnmarshalYAML(value *yaml.Node) error
- type TypeParam
- type Types
- type Union
- type ValueRecord
Constants ¶
This section is empty.
Variables ¶
var ErrSkip = errors.New("skip")
Functions ¶
func LowerFirstWord ¶ added in v1.0.0
func UnderscoreUpperCase ¶ added in v1.1.0
Types ¶
type ChainRecord ¶ added in v1.0.0
type ChainRecord struct { RecordBase ChainType string `json:"chainType,omitempty" form:"chainType" query:"chainType" validate:"required"` }
func (*ChainRecord) FullName ¶ added in v1.0.0
func (r *ChainRecord) FullName() string
func (*ChainRecord) GetName ¶ added in v1.0.0
func (r *ChainRecord) GetName() string
func (*ChainRecord) GetParameters ¶ added in v1.0.0
func (r *ChainRecord) GetParameters() []*Field
func (*ChainRecord) GetParent ¶ added in v1.0.0
func (r *ChainRecord) GetParent() *EntityRecord
func (*ChainRecord) MarshalJSON ¶ added in v1.0.0
func (v *ChainRecord) MarshalJSON() ([]byte, error)
func (*ChainRecord) Type ¶ added in v1.0.0
func (*ChainRecord) Type() RecordType
func (*ChainRecord) UnmarshalJSON ¶ added in v1.0.0
func (v *ChainRecord) UnmarshalJSON(data []byte) error
type CollectionType ¶ added in v1.0.0
type CollectionType int
const CollectionTypeCounted CollectionType = 3
CollectionTypeCounted .
const CollectionTypeList CollectionType = 2
CollectionTypeList .
const CollectionTypeNone CollectionType = 0
CollectionTypeNone .
const CollectionTypeSet CollectionType = 1
CollectionTypeSet .
func CollectionTypeByName ¶ added in v1.0.0
func CollectionTypeByName(name string) (CollectionType, bool)
CollectionTypeByName returns the named Collection Type.
func (CollectionType) GetEnumValue ¶ added in v1.0.0
func (v CollectionType) GetEnumValue() uint64
GetEnumValue returns the value of the Collection Type
func (CollectionType) MarshalJSON ¶ added in v1.0.0
func (v CollectionType) MarshalJSON() ([]byte, error)
MarshalJSON marshals the Collection Type to JSON as a string.
func (*CollectionType) SetEnumValue ¶ added in v1.0.0
func (v *CollectionType) SetEnumValue(id uint64) bool
SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.
func (CollectionType) String ¶ added in v1.0.0
func (v CollectionType) String() string
String returns the name of the Collection Type.
func (*CollectionType) UnmarshalJSON ¶ added in v1.0.0
func (v *CollectionType) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the Collection Type from JSON as a string.
type EntityRecord ¶ added in v1.0.0
type EntityRecord struct { RecordBase Fields []*Field `json:"fields,omitempty" form:"fields" query:"fields" validate:"required"` CustomCommit bool `json:"customCommit,omitempty" form:"customCommit" query:"customCommit" validate:"required"` CustomResolve bool `json:"customResolve,omitempty" form:"customResolve" query:"customResolve" validate:"required"` CustomIsDirty bool `json:"customIsDirty,omitempty" form:"customIsDirty" query:"customIsDirty" validate:"required"` CustomWalk bool `json:"customWalk,omitempty" form:"customWalk" query:"customWalk" validate:"required"` OmitCommit bool `json:"omitCommit,omitempty" form:"omitCommit" query:"omitCommit" validate:"required"` OmitResolve bool `json:"omitResolve,omitempty" form:"omitResolve" query:"omitResolve" validate:"required"` OmitIsDirty bool `json:"omitIsDirty,omitempty" form:"omitIsDirty" query:"omitIsDirty" validate:"required"` OmitWalk bool `json:"omitWalk,omitempty" form:"omitWalk" query:"omitWalk" validate:"required"` ValueStore string `json:"valueStore,omitempty" form:"valueStore" query:"valueStore" validate:"required"` Root bool `json:"root,omitempty" form:"root" query:"root" validate:"required"` Interface bool `json:"interface,omitempty" form:"interface" query:"interface" validate:"required"` Attributes []Record `json:"attributes,omitempty" form:"attributes" query:"attributes" validate:"required"` }
func (*EntityRecord) FullName ¶ added in v1.0.0
func (r *EntityRecord) FullName() string
func (*EntityRecord) GetName ¶ added in v1.0.0
func (r *EntityRecord) GetName() string
func (*EntityRecord) GetParameters ¶ added in v1.0.0
func (r *EntityRecord) GetParameters() []*Field
func (*EntityRecord) GetParent ¶ added in v1.0.0
func (r *EntityRecord) GetParent() *EntityRecord
func (*EntityRecord) MarshalJSON ¶ added in v1.0.0
func (v *EntityRecord) MarshalJSON() ([]byte, error)
func (*EntityRecord) Type ¶ added in v1.0.0
func (*EntityRecord) Type() RecordType
func (*EntityRecord) UnmarshalJSON ¶ added in v1.0.0
func (v *EntityRecord) UnmarshalJSON(data []byte) error
type Field ¶
type Field struct { // Name is the name of the field. Name string // Number overrides the default field number. Number uint `yaml:"field-number"` // Description is the description of the field. Description string // Type is the type of the field. Type FieldType // MarshalAs specifies how to marshal the field. MarshalAs MarshalAs `yaml:"marshal-as"` // MarshalType specifies that the field should be marshalled as the given type. MarshalAsType TypeCode `yaml:"marshal-as-type"` // Repeatable specifies whether the the field is repeatable (represented as a slice). Repeatable bool // Pointer specifies whether the field is a pointer. Pointer bool // Optional specifies whether the field can be omitted. Optional bool // KeepEmpty specifies whether the field should be marshalled even when set to its zero value. KeepEmpty bool `yaml:"keep-empty"` // Alternative specifies an alternative name used for text marshalling. Alternative string // ZeroValue specifies the zero value of the field. ZeroValue interface{} `yaml:"zero-value"` // ElideUnionMethods specifies whether the union type name should be elided from method names. ElideUnionMethods bool `yaml:"elide-union-methods"` // Virtual specifies whether the field is implemented as a method instead of an actual field. Virtual bool // NonBinary specifies whether the field is binary marshallable. NonBinary bool `yaml:"non-binary"` // Toml specifies the name that should be used for TOML marshalling. Toml string }
Field is a field of a type.
type FieldType ¶ added in v0.6.0
func (FieldType) MarshalJSON ¶ added in v1.0.0
func (FieldType) MarshalYAML ¶ added in v0.6.0
func (FieldType) TypescriptInputType ¶ added in v1.1.1
func (FieldType) TypescriptType ¶ added in v1.1.1
func (*FieldType) UnmarshalJSON ¶ added in v1.0.0
func (*FieldType) UnmarshalYAML ¶ added in v0.6.0
type FileReader ¶
type IndexRecord ¶ added in v1.0.0
type IndexRecord struct { RecordBase DataType FieldType `json:"dataType,omitempty" form:"dataType" query:"dataType" validate:"required"` Pointer bool `json:"pointer,omitempty" form:"pointer" query:"pointer" validate:"required"` EmptyIfMissing bool `json:"emptyIfMissing,omitempty" form:"emptyIfMissing" query:"emptyIfMissing" validate:"required"` Union bool `json:"union,omitempty" form:"union" query:"union" validate:"required"` Collection CollectionType `json:"collection,omitempty" form:"collection" query:"collection" validate:"required"` Comparator string `json:"comparator,omitempty" form:"comparator" query:"comparator" validate:"required"` }
func (*IndexRecord) CollectionType ¶ added in v1.0.0
func (r *IndexRecord) CollectionType() CollectionType
func (*IndexRecord) FullName ¶ added in v1.0.0
func (r *IndexRecord) FullName() string
func (*IndexRecord) GetDataType ¶ added in v1.0.0
func (r *IndexRecord) GetDataType() FieldType
func (*IndexRecord) GetName ¶ added in v1.0.0
func (r *IndexRecord) GetName() string
func (*IndexRecord) GetParameters ¶ added in v1.0.0
func (r *IndexRecord) GetParameters() []*Field
func (*IndexRecord) GetParent ¶ added in v1.0.0
func (r *IndexRecord) GetParent() *EntityRecord
func (*IndexRecord) IsCounted ¶ added in v1.0.0
func (r *IndexRecord) IsCounted() bool
func (*IndexRecord) IsList ¶ added in v1.0.0
func (r *IndexRecord) IsList() bool
func (*IndexRecord) IsPointer ¶ added in v1.0.0
func (r *IndexRecord) IsPointer() bool
func (*IndexRecord) IsSet ¶ added in v1.0.0
func (r *IndexRecord) IsSet() bool
func (*IndexRecord) IsUnion ¶ added in v1.0.0
func (r *IndexRecord) IsUnion() bool
func (*IndexRecord) MarshalJSON ¶ added in v1.0.0
func (v *IndexRecord) MarshalJSON() ([]byte, error)
func (*IndexRecord) Type ¶ added in v1.0.0
func (*IndexRecord) Type() RecordType
func (*IndexRecord) UnmarshalJSON ¶ added in v1.0.0
func (v *IndexRecord) UnmarshalJSON(data []byte) error
func (*IndexRecord) Wrapped ¶ added in v1.0.0
func (r *IndexRecord) Wrapped() bool
type MarshalAs ¶ added in v0.6.0
type MarshalAs int
const MarshalAsBasic MarshalAs = 0
MarshalAsBasic marshals the field as a basic type.
const MarshalAsEnum MarshalAs = 2
MarshalAsEnum marshals the field as an enumeration.
const MarshalAsNone MarshalAs = 1
MarshalAsNone omits the field from marshalling.
const MarshalAsReference MarshalAs = 4
MarshalAsReference marshals the field as a reference type.
const MarshalAsUnion MarshalAs = 5
MarshalAsUnion marshals the field as a union type.
const MarshalAsValue MarshalAs = 3
MarshalAsValue marshals the field as a value type.
func MarshalAsByName ¶ added in v0.6.0
MarshalAsByName returns the named Marshal As.
func (MarshalAs) GetEnumValue ¶ added in v0.6.0
GetEnumValue returns the value of the Marshal As
func (MarshalAs) MarshalJSON ¶ added in v0.6.0
MarshalJSON marshals the Marshal As to JSON as a string.
func (*MarshalAs) MarshalYAML ¶ added in v0.6.0
func (*MarshalAs) SetEnumValue ¶ added in v0.6.0
SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.
func (*MarshalAs) UnmarshalJSON ¶ added in v0.6.0
UnmarshalJSON unmarshals the Marshal As from JSON as a string.
func (*MarshalAs) UnmarshalYAML ¶ added in v0.6.0
type Method ¶
type Method struct { Kind string Description string Deprecated string Experimental bool RPC string Input string Output string Call string RouteParam string `yaml:"route-param"` CallParams []string `yaml:"call-params"` Validate []string `yaml:"validate"` }
Method is a method of an API.
type OtherRecord ¶ added in v1.0.0
type OtherRecord struct { RecordBase DataType string `json:"dataType,omitempty" form:"dataType" query:"dataType" validate:"required"` Pointer bool `json:"pointer,omitempty" form:"pointer" query:"pointer" validate:"required"` HasChains bool `json:"hasChains,omitempty" form:"hasChains" query:"hasChains" validate:"required"` Constructor string `json:"constructor,omitempty" form:"constructor" query:"constructor" validate:"required"` }
func (*OtherRecord) FullName ¶ added in v1.0.0
func (r *OtherRecord) FullName() string
func (*OtherRecord) GetName ¶ added in v1.0.0
func (r *OtherRecord) GetName() string
func (*OtherRecord) GetParameters ¶ added in v1.0.0
func (r *OtherRecord) GetParameters() []*Field
func (*OtherRecord) GetParent ¶ added in v1.0.0
func (r *OtherRecord) GetParent() *EntityRecord
func (*OtherRecord) MarshalJSON ¶ added in v1.0.0
func (v *OtherRecord) MarshalJSON() ([]byte, error)
func (*OtherRecord) Type ¶ added in v1.0.0
func (*OtherRecord) Type() RecordType
func (*OtherRecord) UnmarshalJSON ¶ added in v1.0.0
func (v *OtherRecord) UnmarshalJSON(data []byte) error
type Record ¶ added in v1.0.0
type Record interface { Type() RecordType GetParent() *EntityRecord GetParameters() []*Field FullName() string GetName() string }
func NewRecord ¶ added in v1.0.0
func NewRecord(typ RecordType) (Record, error)
NewRecord creates a new Record for the specified RecordType.
func UnmarshalRecordJSON ¶ added in v1.0.0
UnmarshalRecordJson unmarshals a Record.
type RecordBase ¶ added in v1.1.1
type RecordBase struct { Name string `json:"name,omitempty" form:"name" query:"name" validate:"required"` Key string `json:"key,omitempty" form:"key" query:"key" validate:"required"` Description string `json:"description,omitempty" form:"description" query:"description" validate:"required"` Parent *EntityRecord `json:"parent,omitempty" form:"parent" query:"parent" validate:"required"` Private bool `json:"private,omitempty" form:"private" query:"private" validate:"required"` OmitAccessor bool `json:"omitAccessor,omitempty" form:"omitAccessor" query:"omitAccessor" validate:"required"` OmitConstructor bool `json:"omitConstructor,omitempty" form:"omitConstructor" query:"omitConstructor" validate:"required"` CustomValueConstructor bool `json:"customValueConstructor,omitempty" form:"customValueConstructor" query:"customValueConstructor" validate:"required"` Parameters []*Field `json:"parameters,omitempty" form:"parameters" query:"parameters" validate:"required"` Index string `json:"index,omitempty" form:"index" query:"index" validate:"required"` }
func (*RecordBase) MarshalJSON ¶ added in v1.1.1
func (v *RecordBase) MarshalJSON() ([]byte, error)
func (*RecordBase) UnmarshalJSON ¶ added in v1.1.1
func (v *RecordBase) UnmarshalJSON(data []byte) error
type RecordType ¶ added in v1.0.0
type RecordType int
const RecordTypeChain RecordType = 3
RecordTypeChain .
const RecordTypeEntity RecordType = 1
RecordTypeEntity .
const RecordTypeIndex RecordType = 4
RecordTypeIndex .
const RecordTypeOther RecordType = 5
RecordTypeOther .
const RecordTypeState RecordType = 2
RecordTypeState .
func RecordTypeByName ¶ added in v1.0.0
func RecordTypeByName(name string) (RecordType, bool)
RecordTypeByName returns the named Record Type.
func (RecordType) GetEnumValue ¶ added in v1.0.0
func (v RecordType) GetEnumValue() uint64
GetEnumValue returns the value of the Record Type
func (RecordType) IsChain ¶ added in v1.0.0
func (t RecordType) IsChain() bool
func (RecordType) IsEntity ¶ added in v1.0.0
func (t RecordType) IsEntity() bool
func (RecordType) IsIndex ¶ added in v1.0.0
func (t RecordType) IsIndex() bool
func (RecordType) IsOther ¶ added in v1.0.0
func (t RecordType) IsOther() bool
func (RecordType) IsState ¶ added in v1.0.0
func (t RecordType) IsState() bool
func (RecordType) MarshalJSON ¶ added in v1.0.0
func (v RecordType) MarshalJSON() ([]byte, error)
MarshalJSON marshals the Record Type to JSON as a string.
func (*RecordType) SetEnumValue ¶ added in v1.0.0
func (v *RecordType) SetEnumValue(id uint64) bool
SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.
func (RecordType) String ¶ added in v1.0.0
func (v RecordType) String() string
String returns the name of the Record Type.
func (*RecordType) UnmarshalJSON ¶ added in v1.0.0
func (v *RecordType) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the Record Type from JSON as a string.
type StateRecord ¶ added in v1.0.0
type StateRecord struct { RecordBase DataType FieldType `json:"dataType,omitempty" form:"dataType" query:"dataType" validate:"required"` Pointer bool `json:"pointer,omitempty" form:"pointer" query:"pointer" validate:"required"` EmptyIfMissing bool `json:"emptyIfMissing,omitempty" form:"emptyIfMissing" query:"emptyIfMissing" validate:"required"` Union bool `json:"union,omitempty" form:"union" query:"union" validate:"required"` Collection CollectionType `json:"collection,omitempty" form:"collection" query:"collection" validate:"required"` Comparator string `json:"comparator,omitempty" form:"comparator" query:"comparator" validate:"required"` }
func (*StateRecord) CollectionType ¶ added in v1.0.0
func (r *StateRecord) CollectionType() CollectionType
func (*StateRecord) FullName ¶ added in v1.0.0
func (r *StateRecord) FullName() string
func (*StateRecord) GetDataType ¶ added in v1.0.0
func (r *StateRecord) GetDataType() FieldType
func (*StateRecord) GetName ¶ added in v1.0.0
func (r *StateRecord) GetName() string
func (*StateRecord) GetParameters ¶ added in v1.0.0
func (r *StateRecord) GetParameters() []*Field
func (*StateRecord) GetParent ¶ added in v1.0.0
func (r *StateRecord) GetParent() *EntityRecord
func (*StateRecord) IsCounted ¶ added in v1.0.0
func (r *StateRecord) IsCounted() bool
func (*StateRecord) IsList ¶ added in v1.0.0
func (r *StateRecord) IsList() bool
func (*StateRecord) IsPointer ¶ added in v1.0.0
func (r *StateRecord) IsPointer() bool
func (*StateRecord) IsSet ¶ added in v1.0.0
func (r *StateRecord) IsSet() bool
func (*StateRecord) IsUnion ¶ added in v1.0.0
func (r *StateRecord) IsUnion() bool
func (*StateRecord) MarshalJSON ¶ added in v1.0.0
func (v *StateRecord) MarshalJSON() ([]byte, error)
func (*StateRecord) Type ¶ added in v1.0.0
func (*StateRecord) Type() RecordType
func (*StateRecord) UnmarshalJSON ¶ added in v1.0.0
func (v *StateRecord) UnmarshalJSON(data []byte) error
func (*StateRecord) Wrapped ¶ added in v1.0.0
func (r *StateRecord) Wrapped() bool
type TemplateLibrary ¶
type TemplateLibrary struct {
// contains filtered or unexported fields
}
func NewTemplateLibrary ¶
func NewTemplateLibrary(funcs template.FuncMap) *TemplateLibrary
func (*TemplateLibrary) Execute ¶
func (lib *TemplateLibrary) Execute(w io.Writer, name string, data interface{}) error
type Type ¶
type Type struct { // Name is the name of the type. Name string `yaml:"-"` // Params are the type parameters of a generic type. Params []*TypeParam `yaml:"-"` // File is the file the type was loaded from. File string `yaml:"-"` // Package is the package the type was loaded from. Package string `yaml:"-"` // Description is the description of the type. Description string // Union is the tagged union specifier for the type. Union Union // NonBinary specifies whether the type is binary marshallable. NonBinary bool `yaml:"non-binary"` // NonJSON specifies whether the type is JSON marshallable. NonJSON bool `yaml:"non-json"` // Incomparable specifies whether two values of the type can be checked for equality. Incomparable bool `yaml:"incomparable"` NoCopy bool `yaml:"no-copy"` IgnoreSizeLimit bool `yaml:"ignore-size-limit"` // CustomIsValid specifies the type defines a custom IsValid() error method. CustomIsValid bool `yaml:"custom-is-valid"` // CustomEqual specifies the type defines a custom Equal() error method. CustomEqual bool `yaml:"custom-equal"` // Fields is a list of fields. Fields []*Field // Embeddings is a list of embedded types. Embeddings []string `yaml:"embeddings"` }
Type is a struct type.
func (*Type) ResolveTypeParam ¶ added in v1.1.0
func (*Type) TypescriptFullName ¶ added in v1.1.1
type TypeCode ¶ added in v0.6.0
type TypeCode int
const TypeCodeAny TypeCode = 11
TypeCodeAny .
const TypeCodeBigInt TypeCode = 10
TypeCodeBigInt .
const TypeCodeBool TypeCode = 3
TypeCodeBool .
const TypeCodeBytes TypeCode = 6
TypeCodeBytes .
const TypeCodeDuration TypeCode = 9
TypeCodeDuration .
const TypeCodeFloat TypeCode = 13
TypeCodeFloat .
const TypeCodeHash TypeCode = 5
TypeCodeHash .
const TypeCodeInt TypeCode = 1
TypeCodeInt .
const TypeCodeRawJson TypeCode = 12
TypeCodeRawJson .
const TypeCodeString TypeCode = 4
TypeCodeString .
const TypeCodeTime TypeCode = 8
TypeCodeTime .
const TypeCodeTxid TypeCode = 14
TypeCodeTxid .
const TypeCodeUint TypeCode = 2
TypeCodeUint .
const TypeCodeUnknown TypeCode = 0
TypeCodeUnknown .
const TypeCodeUrl TypeCode = 7
TypeCodeUrl .
func TypeCodeByName ¶ added in v0.6.0
TypeCodeByName returns the named Type Code.
func (TypeCode) GetEnumValue ¶ added in v0.6.0
GetEnumValue returns the value of the Type Code
func (TypeCode) MarshalJSON ¶ added in v0.6.0
MarshalJSON marshals the Type Code to JSON as a string.
func (TypeCode) MarshalYAML ¶ added in v1.1.0
func (*TypeCode) SetEnumValue ¶ added in v0.6.0
SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.
func (TypeCode) TypescriptInputType ¶ added in v1.1.1
func (TypeCode) TypescriptType ¶ added in v1.1.1
func (*TypeCode) UnmarshalJSON ¶ added in v0.6.0
UnmarshalJSON unmarshals the Type Code from JSON as a string.
func (*TypeCode) UnmarshalYAML ¶ added in v1.1.0
type Union ¶ added in v0.5.1
type Union struct { // Name is the name of the union type. Name string // Type is the name of the tag type. Type string // Value is the name of the corresponding enumeration value. Value string // Private indicates the union is a private type. Private bool // Registry indicates the union supports registering new members. Registry bool }
Union specifies that a type is part of a tagged union.