Documentation ¶
Index ¶
- type Component
- type Converter
- type Field
- type ImportReference
- type Model
- type Option
- type TSFormatter
- type TSGen
- func (tg *TSGen) Component() ([]byte, error)
- func (tg *TSGen) ComponentConfig(c Component) ([]byte, error)
- func (tg *TSGen) ComponentFactory() ([]byte, error)
- func (tg *TSGen) Names(source string) ([]string, error)
- func (tg *TSGen) Reflect(names []string) (*Model, error)
- func (tg *TSGen) ReflectTemplate(names []string) ([]byte, error)
- func (tg *TSGen) Stage(dest string, model *Model) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
Component is a component in the model.
func (Component) Referenced ¶
func (c Component) Referenced() []ImportReference
Referenced returns import references for this Component.
type Converter ¶
type Converter struct {
// contains filtered or unexported fields
}
Converter converts types to typescript.
func NewConverter ¶
NewConverter creates an instance of Converter.
type Field ¶
Field is a struct field in a Component.
func ConvertField ¶
ConvertField converts struct field a to a tsgen Field. If the field cannot be converted to a type script type, it will panic. If the field should be skipped, it will return false the second return value.
func (Field) TSFactoryType ¶
TSFactoryType returns the typescript factory type for a field.
func (Field) TSNameToComponent ¶
TSNameToComponent converts a field to a component.
type ImportReference ¶
type ImportReference struct { // Name is the name of the component. Name string // Import name is the name of the file that will be imported. ImportName string }
ImportReference is a reference for an import that is used to build typescript imports.
type Option ¶
type Option func(o *options)
Option is an option for configuration tsgen.
func DisableFormatter ¶
func DisableFormatter() Option
DisableFormatter disables the typescript formatter.
type TSFormatter ¶
type TSFormatter struct{}
TSFormatter formats typescript.
func NewTSFormatter ¶
func NewTSFormatter() *TSFormatter
NewTSFormatter creates an instance of the typescript formatter.
type TSGen ¶
type TSGen struct {
// contains filtered or unexported fields
}
TSGen generates typescript for components.
func (*TSGen) ComponentConfig ¶
ComponentConfig generates a config interface and factory for a model component.
func (*TSGen) ComponentFactory ¶
ComponentFactory generates the typescript component factory interface.
func (*TSGen) Reflect ¶
Reflect reflects on list of components. It generates a temporary binary and runs that to get type information for components.
func (*TSGen) ReflectTemplate ¶
ReflectTemplate generates a reflect template.