Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEnumConstantsAsMap ¶ added in v1.0.5
GetEnumConstantsAsMap extracts enum constants associated with the given type and returns a map of "constant name" -> "constant value"
func GetIoTsEnumText ¶ added in v1.0.5
func IsEnumType ¶ added in v1.0.5
IsEnumType checks if the given reflect.Type has any matching constants in its package.
Types ¶
type CodeBuilder ¶ added in v1.0.3
type CodeBuilder struct {
// contains filtered or unexported fields
}
CodeBuilder handles the assembly of generated code
func NewCodeBuilder ¶ added in v1.0.3
func NewCodeBuilder() *CodeBuilder
NewCodeBuilder creates a new CodeBuilder instance
func (*CodeBuilder) AddTypeDefinition ¶ added in v1.0.3
func (cb *CodeBuilder) AddTypeDefinition(typeDef string)
AddTypeDefinition adds a type definition to the builder
func (*CodeBuilder) Build ¶ added in v1.0.3
func (cb *CodeBuilder) Build() string
Build assembles the final code output
func (*CodeBuilder) IsTypeProcessed ¶ added in v1.0.3
func (cb *CodeBuilder) IsTypeProcessed(typeKey string) bool
IsTypeProcessed checks if a type has already been processed
func (*CodeBuilder) MarkTypeProcessed ¶ added in v1.0.3
func (cb *CodeBuilder) MarkTypeProcessed(typeKey string)
MarkTypeProcessed marks a type as processed
type DefaultTypeConverter ¶ added in v1.0.3
type DefaultTypeConverter struct {
// contains filtered or unexported fields
}
DefaultTypeConverter is the default implementation of TypeConverter
type FieldProcessor ¶ added in v1.0.3
type FieldProcessor interface { ProcessField(field reflect.StructField) string ProcessInlineField(field reflect.StructField) []string }
FieldProcessor defines an interface for processing struct fields
type IoTsGenerator ¶
type IoTsGenerator struct {
// contains filtered or unexported fields
}
IoTsGenerator encapsulates the logic to generate io-ts types
func NewIoTsGenerator ¶
func NewIoTsGenerator(options ...TypeScriptGeneratorOptions) *IoTsGenerator
NewIoTsGenerator creates a new instance of NewIoTsGenerator with the provided options
func (*IoTsGenerator) Generate ¶
func (g *IoTsGenerator) Generate(inputStruct interface{}) (string, error)
Generate takes any struct and generates its corresponding io-ts type
type TypeConverter ¶ added in v1.0.3
TypeConverter defines an interface for converting Go types to io-ts types
type TypeScriptGeneratorOptions ¶
type TypeScriptGeneratorOptions struct {
TreatArraysAsOptional bool
}
TypeScriptGeneratorOptions defines options for generating TypeScript interfaces