generator

package
v0.0.0-...-bc83711 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2015 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IdNamePattern        = "%sId"
	StoreNamePattern     = "%sStore"
	QueryNamePattern     = "%sQuery"
	ResultSetNamePattern = "%sResultSet"
)
View Source
const BaseDocument = "github.com/tyba/storable.Document"

Variables

This section is empty.

Functions

func NewFunction

func NewFunction()

Types

type Field

type Field struct {
	Name        string
	Type        string
	CheckedNode *types.Var
	Tag         reflect.StructTag
	Fields      []*Field
	Parent      *Field
	// contains filtered or unexported fields
}

func NewField

func NewField(n, t string, tag reflect.StructTag) *Field

func (*Field) AddField

func (f *Field) AddField(field *Field)

func (*Field) ContainsMap

func (f *Field) ContainsMap() bool

func (*Field) DbName

func (f *Field) DbName() string

func (*Field) Findable

func (f *Field) Findable() bool

func (*Field) FindableType

func (f *Field) FindableType() string

func (*Field) GetPath

func (f *Field) GetPath() string

func (*Field) GetTagValue

func (f *Field) GetTagValue(key string) string

func (*Field) SetFields

func (f *Field) SetFields(sf []*Field)

func (*Field) String

func (f *Field) String() string

func (*Field) ValidFields

func (f *Field) ValidFields() []*Field

type Function

type Function struct {
	Name string
	Args string
}

type Generator

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

func NewGenerator

func NewGenerator(filename string) *Generator

func (*Generator) Generate

func (g *Generator) Generate(pkg *Package) error

type Model

type Model struct {
	Name          string
	IdName        string
	StoreName     string
	QueryName     string
	ResultSetName string

	Collection  string
	Type        string
	Fields      []*Field
	CheckedNode *types.Struct
}

func NewModel

func NewModel(n string) *Model

func (*Model) String

func (m *Model) String() string

func (*Model) ValidFields

func (m *Model) ValidFields() []*Field

type Package

type Package struct {
	Name      string
	Models    []*Model
	Structs   []string
	Functions []string
}

func (*Package) FunctionIsDefined

func (p *Package) FunctionIsDefined(name string) bool

func (*Package) StructIsDefined

func (p *Package) StructIsDefined(name string) bool

type Processor

type Processor struct {
	Path   string
	Ignore map[string]bool
	// contains filtered or unexported fields
}

func NewProcessor

func NewProcessor(path string, ignore []string) *Processor

func (*Processor) Do

func (p *Processor) Do() (*Package, error)

func (*Processor) ProcessTypesPkg

func (p *Processor) ProcessTypesPkg(typesPkg *types.Package) (*Package, error)

type Template

type Template struct {
	// contains filtered or unexported fields
}
var Base *Template = &Template{template: base}

func (*Template) Execute

func (t *Template) Execute(wr io.Writer, data *Package) error

type TemplateData

type TemplateData struct {
	*Package
	Fields []*TemplateField
	// contains filtered or unexported fields
}

func (*TemplateData) GenType

func (td *TemplateData) GenType(vi interface{}, path string) string

func (*TemplateData) GenVar

func (td *TemplateData) GenVar(vi interface{}, done map[interface{}]bool) string

func (*TemplateData) LinkStruct

func (td *TemplateData) LinkStruct(path string, vi interface{}) string

func (*TemplateData) StructValue

func (td *TemplateData) StructValue(vi interface{}, done map[interface{}]bool) string

type TemplateField

type TemplateField struct {
	Name   string
	Path   string
	Fields interface{}
}

func (*TemplateField) ValidFields

func (tf *TemplateField) ValidFields() []*Field

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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