parse

package
v0.0.0-...-e6cc08a Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(meta *MetaData, options ...OptionFunc) error

Types

type Field

type Field struct {
	Name     string  `json:"name,omitempty"`
	Skip     bool    `json:"skip,omitempty"`
	Kind     string  `json:"type,omitempty"`
	Type     string  `json:"type,omitempty"`
	MaxLen   int     `json:"maxLen,omitempty"`
	MaxValue int     `json:"maxValue,omitempty"`
	Refer    string  `json:"refer,omitempty"` // 自定义数据
	Comment  string  `json:"comment,omitempty"`
	Fields   []Field `json:"fields,omitempty"`
}

type MetaData

type MetaData struct {
	Package    string  `json:"package,omitempty"`
	StructName string  `json:"structName,omitempty"`
	Fields     []Field `json:"fields,omitempty"`
	Imports    []string
}

func Parse

func Parse(st interface{}) (*MetaData, error)

type Option

type Option struct {
	// contains filtered or unexported fields
}

type OptionFunc

type OptionFunc func(option *Option)

func WithFileName

func WithFileName(name string) OptionFunc

func WithFuncMap

func WithFuncMap(fmap template.FuncMap) OptionFunc

func WithTemplateName

func WithTemplateName(names []string) OptionFunc

Jump to

Keyboard shortcuts

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