typegen

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSkip = errors.New("skip")

Functions

func DashCase added in v1.0.0

func DashCase(s string) string

func GetModifiedDate added in v1.1.0

func GetModifiedDate(file string) (time.Time, error)

func GoFmt

func GoFmt(filePath string, buf *bytes.Buffer) error

func LowerFirstWord added in v1.0.0

func LowerFirstWord(s string) string

func MakeMap added in v1.0.0

func MakeMap(v ...interface{}) map[string]interface{}

func Natural added in v1.0.0

func Natural(name string) string

func ReadMap added in v1.0.0

func ReadMap[V any](f *FileReader, files []string, recordFile func(string, V)) (map[string]V, error)

func ReadRaw added in v1.0.0

func ReadRaw[V any](files []string, recordFile func(string, V)) (map[string]V, error)

func TitleCase added in v0.6.0

func TitleCase(s string) string

func UnderscoreUpperCase added in v1.1.0

func UnderscoreUpperCase(s string) string

func WriteFile

func WriteFile(file string, buf *bytes.Buffer) error

Types

type API

type API map[string]Method

API is an API with a set of methods.

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 Enum added in v0.6.0

type Enum map[string]*EnumValue

Enum is an enumeration with a set of values.

type EnumValue added in v0.6.0

type EnumValue struct {
	Value       interface{}
	Name        string
	Description string
	Label       string
	Aliases     []string
}

EnumValue is a particular value of an enumeration.

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

type FieldType struct {
	Code       TypeCode
	Name       string
	Parameters []*Field
}

func (FieldType) CType added in v1.2.10

func (f FieldType) CType() string

CType generated code requires common/encoding.h

func (*FieldType) Equal added in v1.1.0

func (f *FieldType) Equal(g *FieldType) bool

func (FieldType) GoType added in v1.0.0

func (f FieldType) GoType() string

func (*FieldType) IsKnown added in v1.1.0

func (f *FieldType) IsKnown() bool

func (FieldType) JavaType added in v1.1.0

func (f FieldType) JavaType() string

func (FieldType) MarshalJSON added in v1.0.0

func (f FieldType) MarshalJSON() ([]byte, error)

func (FieldType) MarshalYAML added in v0.6.0

func (f FieldType) MarshalYAML() (interface{}, error)

func (*FieldType) SetKnown added in v0.6.0

func (f *FieldType) SetKnown(code TypeCode)

func (*FieldType) SetNamed added in v0.6.0

func (f *FieldType) SetNamed(name string)

func (FieldType) String added in v0.6.0

func (f FieldType) String() string

func (*FieldType) Title added in v0.6.0

func (f *FieldType) Title() string

func (FieldType) TypescriptInputType added in v1.1.1

func (f FieldType) TypescriptInputType(args bool) string

func (FieldType) TypescriptType added in v1.1.1

func (f FieldType) TypescriptType(args bool) string

func (*FieldType) UnmarshalJSON added in v1.0.0

func (f *FieldType) UnmarshalJSON(data []byte) error

func (*FieldType) UnmarshalYAML added in v0.6.0

func (f *FieldType) UnmarshalYAML(value *yaml.Node) error

type FileReader

type FileReader struct {
	Include []string
	Exclude []string
	Rename  []string
}

func (*FileReader) SetFlags

func (f *FileReader) SetFlags(flags *pflag.FlagSet, label string)

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

func MarshalAsByName(name string) (MarshalAs, bool)

MarshalAsByName returns the named Marshal As.

func (MarshalAs) GetEnumValue added in v0.6.0

func (v MarshalAs) GetEnumValue() uint64

GetEnumValue returns the value of the Marshal As

func (MarshalAs) MarshalJSON added in v0.6.0

func (v MarshalAs) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Marshal As to JSON as a string.

func (*MarshalAs) MarshalYAML added in v0.6.0

func (m *MarshalAs) MarshalYAML() (interface{}, error)

func (*MarshalAs) SetEnumValue added in v0.6.0

func (v *MarshalAs) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (MarshalAs) String added in v0.6.0

func (v MarshalAs) String() string

String returns the name of the Marshal As.

func (*MarshalAs) UnmarshalJSON added in v0.6.0

func (v *MarshalAs) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Marshal As from JSON as a string.

func (*MarshalAs) UnmarshalYAML added in v0.6.0

func (m *MarshalAs) UnmarshalYAML(value *yaml.Node) error

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

func UnmarshalRecordJSON(data []byte) (Record, error)

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

func (*TemplateLibrary) Parse added in v1.1.0

func (lib *TemplateLibrary) Parse(src, name string, funcs template.FuncMap) (*template.Template, error)

func (*TemplateLibrary) Register

func (lib *TemplateLibrary) Register(src, name string, funcs template.FuncMap, altNames ...string) *template.Template

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) FullName added in v1.1.0

func (t *Type) FullName(paramName, paramType bool) string

func (*Type) ResolveTypeParam added in v1.1.0

func (t *Type) ResolveTypeParam(f *Field) (*TypeParam, bool)

func (*Type) TypescriptFullName added in v1.1.1

func (t *Type) TypescriptFullName(args, withType, paramName, paramType bool) string

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

func TypeCodeByName(name string) (TypeCode, bool)

TypeCodeByName returns the named Type Code.

func (TypeCode) GetEnumValue added in v0.6.0

func (v TypeCode) GetEnumValue() uint64

GetEnumValue returns the value of the Type Code

func (TypeCode) GoType added in v1.1.0

func (t TypeCode) GoType() string

func (TypeCode) MarshalJSON added in v0.6.0

func (v TypeCode) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Type Code to JSON as a string.

func (TypeCode) MarshalYAML added in v1.1.0

func (f TypeCode) MarshalYAML() (interface{}, error)

func (*TypeCode) SetEnumValue added in v0.6.0

func (v *TypeCode) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (TypeCode) String added in v0.6.0

func (v TypeCode) String() string

String returns the name of the Type Code.

func (TypeCode) Title added in v1.1.0

func (t TypeCode) Title() string

func (TypeCode) TypescriptInputType added in v1.1.1

func (t TypeCode) TypescriptInputType() string

func (TypeCode) TypescriptType added in v1.1.1

func (t TypeCode) TypescriptType() string

func (*TypeCode) UnmarshalJSON added in v0.6.0

func (v *TypeCode) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Type Code from JSON as a string.

func (*TypeCode) UnmarshalYAML added in v1.1.0

func (f *TypeCode) UnmarshalYAML(value *yaml.Node) error

type TypeParam added in v1.1.0

type TypeParam struct {
	Name string
	Type string
}

TypeParam is a type parameter of a generic type.

type Types added in v0.6.0

type Types []*Type

Types is a list of struct types.

func (Types) Sort added in v0.6.0

func (t Types) Sort()

func (*Types) Unmap added in v1.0.0

func (t *Types) Unmap(types map[string]*Type, files map[*Type]string, packages map[string]string) error

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.

type ValueRecord added in v1.0.0

type ValueRecord interface {
	Record
	Wrapped() bool
	CollectionType() CollectionType
	IsSet() bool
	IsList() bool
	IsCounted() bool
	IsPointer() bool
	IsUnion() bool
	GetDataType() FieldType
}

Jump to

Keyboard shortcuts

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