typegen

package
v0.5.1-rc6a Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoFmt

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

func WriteFile

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

Types

type API

type API map[string]Method

type DataType

type DataType struct {
	Name         string `yaml:"-"`
	Description  string
	Union        Union
	NonBinary    bool `yaml:"non-binary"`
	Incomparable bool `yaml:"incomparable"`
	OmitNewFunc  bool `yaml:"omit-new-func"`
	Fields       []*Field
	Embeddings   []string `yaml:"embeddings"`
}

type DataTypes

type DataTypes []*DataType

func DataTypesFrom

func DataTypesFrom(m map[string]*DataType) DataTypes

type Field

type Field struct {
	Name          string
	Description   string
	Type          string
	MarshalAs     string `yaml:"marshal-as"`
	UnmarshalWith string `yaml:"unmarshal-with"`
	Repeatable    bool
	Pointer       bool
	Optional      bool
	KeepEmpty     bool `yaml:"keep-empty"`
	Alternative   string
	ZeroValue     interface{} `yaml:"zero-value"`
}

type FileReader

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

func (*FileReader) Read

func (f *FileReader) Read(files []string, typ reflect.Type) (interface{}, error)

func (*FileReader) SetFlags

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

type Method

type Method struct {
	Kind        string
	Description string
	Deprecated  string
	RPC         string
	Input       string
	Output      string
	Call        string
	CallParams  []string `yaml:"call-params"`
	Validate    []string `yaml:"validate"`
}

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) Register

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

type Type

type Type map[string]*TypeValue

type TypeValue

type TypeValue struct {
	Value       interface{}
	Description string
	Aliases     []string
}

type Union added in v0.5.1

type Union struct {
	Type  string
	Value string
}

Jump to

Keyboard shortcuts

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