Documentation ¶
Index ¶
- type EnumType
- type StructType
- type TSNamer
- type TypeOptions
- type TypeScriptify
- func (t *TypeScriptify) Add(obj interface{}) *TypeScriptify
- func (t *TypeScriptify) AddEnum(values interface{}) *TypeScriptify
- func (t *TypeScriptify) AddEnumValues(typeOf reflect.Type, values interface{}) *TypeScriptify
- func (t *TypeScriptify) AddImport(i string)
- func (t *TypeScriptify) AddType(typeOf reflect.Type) *TypeScriptify
- func (t *TypeScriptify) Convert(customCode map[string]string) (string, error)
- func (t TypeScriptify) ConvertToFile(fileName string) error
- func (t *TypeScriptify) ManageType(fld interface{}, opts TypeOptions) *TypeScriptify
- func (ts *TypeScriptify) Silent() *TypeScriptify
- func (t *TypeScriptify) WithBackupDir(b string) *TypeScriptify
- func (t *TypeScriptify) WithConstructor(b bool) *TypeScriptify
- func (t *TypeScriptify) WithCreateFromMethod(b bool) *TypeScriptify
- func (t *TypeScriptify) WithCustomCodeAfter(i string)
- func (t *TypeScriptify) WithCustomCodeBefore(i string)
- func (t *TypeScriptify) WithCustomJsonTag(tag string) *TypeScriptify
- func (t *TypeScriptify) WithIndent(i string) *TypeScriptify
- func (t *TypeScriptify) WithInterface(b bool) *TypeScriptify
- func (t *TypeScriptify) WithPrefix(p string) *TypeScriptify
- func (t *TypeScriptify) WithSuffix(s string) *TypeScriptify
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StructType ¶ added in v0.1.1
type StructType struct { Type reflect.Type FieldOptions map[reflect.Type]TypeOptions }
StructType stores settings for transforming one Golang struct.
func NewStruct ¶ added in v0.1.1
func NewStruct(i interface{}) *StructType
func (*StructType) WithFieldOpts ¶ added in v0.1.1
func (st *StructType) WithFieldOpts(i interface{}, opts TypeOptions) *StructType
type TypeOptions ¶ added in v0.1.1
TypeOptions overrides options set by `ts_*` tags.
type TypeScriptify ¶
type TypeScriptify struct { Prefix string Suffix string Indent string CreateFromMethod bool CreateConstructor bool BackupDir string // If empty no backup DontExport bool CreateInterface bool CustomJsonTag string // contains filtered or unexported fields }
func New ¶
func New() *TypeScriptify
func (*TypeScriptify) Add ¶
func (t *TypeScriptify) Add(obj interface{}) *TypeScriptify
func (*TypeScriptify) AddEnum ¶ added in v0.0.11
func (t *TypeScriptify) AddEnum(values interface{}) *TypeScriptify
func (*TypeScriptify) AddEnumValues ¶ added in v0.0.10
func (t *TypeScriptify) AddEnumValues(typeOf reflect.Type, values interface{}) *TypeScriptify
AddEnumValues is deprecated, use `AddEnum()`
func (*TypeScriptify) AddImport ¶ added in v0.1.0
func (t *TypeScriptify) AddImport(i string)
func (*TypeScriptify) AddType ¶
func (t *TypeScriptify) AddType(typeOf reflect.Type) *TypeScriptify
func (*TypeScriptify) Convert ¶
func (t *TypeScriptify) Convert(customCode map[string]string) (string, error)
func (TypeScriptify) ConvertToFile ¶
func (t TypeScriptify) ConvertToFile(fileName string) error
func (*TypeScriptify) ManageType ¶ added in v0.1.1
func (t *TypeScriptify) ManageType(fld interface{}, opts TypeOptions) *TypeScriptify
ManageType can define custom options for fields of a specified type.
This can be used instead of setting ts_type and ts_transform for all fields of a certain type.
func (*TypeScriptify) Silent ¶ added in v0.2.0
func (ts *TypeScriptify) Silent() *TypeScriptify
func (*TypeScriptify) WithBackupDir ¶ added in v0.1.0
func (t *TypeScriptify) WithBackupDir(b string) *TypeScriptify
func (*TypeScriptify) WithConstructor ¶ added in v0.1.0
func (t *TypeScriptify) WithConstructor(b bool) *TypeScriptify
func (*TypeScriptify) WithCreateFromMethod ¶ added in v0.1.0
func (t *TypeScriptify) WithCreateFromMethod(b bool) *TypeScriptify
func (*TypeScriptify) WithCustomCodeAfter ¶ added in v0.2.0
func (t *TypeScriptify) WithCustomCodeAfter(i string)
func (*TypeScriptify) WithCustomCodeBefore ¶ added in v0.2.0
func (t *TypeScriptify) WithCustomCodeBefore(i string)
func (*TypeScriptify) WithCustomJsonTag ¶ added in v0.2.0
func (t *TypeScriptify) WithCustomJsonTag(tag string) *TypeScriptify
func (*TypeScriptify) WithIndent ¶ added in v0.1.0
func (t *TypeScriptify) WithIndent(i string) *TypeScriptify
func (*TypeScriptify) WithInterface ¶ added in v0.1.6
func (t *TypeScriptify) WithInterface(b bool) *TypeScriptify
func (*TypeScriptify) WithPrefix ¶ added in v0.1.0
func (t *TypeScriptify) WithPrefix(p string) *TypeScriptify
func (*TypeScriptify) WithSuffix ¶ added in v0.1.0
func (t *TypeScriptify) WithSuffix(s string) *TypeScriptify
Click to show internal directories.
Click to hide internal directories.