parse

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2015 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Consume

func Consume(line, prefix string) (bool, string)

func EndsMultilineComment

func EndsMultilineComment(line string) (bool, string)

func IsComment

func IsComment(line string) bool

func ParseIndexes

func ParseIndexes(lines []string) (string, error)

func StartsMultilineComment

func StartsMultilineComment(line string) bool

Types

type ActiveFile

type ActiveFile struct {
	SrcName string
	AST     *ast.File
}

func (ActiveFile) DefName

func (af ActiveFile) DefName() string

type Column

type Column struct {
	GoType, Name string
	Tag          reflect.StructTag
	Pkg          *Package
	MustNull     bool
	Array        bool
	Tbl          *Table
	IncludeName  string
	// contains filtered or unexported fields
}

func (*Column) IterateColumns

func (c *Column) IterateColumns(ch chan Column)

func (Column) Length

func (c Column) Length() int

func (Column) NonZeroCheck

func (c Column) NonZeroCheck() string

func (Column) Preset

func (c Column) Preset() bool

func (Column) SimpleType

func (c Column) SimpleType() bool

func (Column) Subcolumns

func (c Column) Subcolumns() chan Column

func (Column) Subrecord

func (c Column) Subrecord() *Subrecord

func (Column) Type

func (c Column) Type() string

type Func

type Func struct {
	Name string
	Spec *ast.FuncDecl
	File *ast.File
}

type Index

type Index struct {
	Columns []string
}

type Mixin

type Mixin struct {
	Name string
	Spec *ast.TypeSpec
	File *ast.File
}

func (Mixin) Fields

func (m Mixin) Fields() []*ast.Field

type Mixinable

type Mixinable interface {
	Name() string
	Spec() *ast.TypeSpec
	File() *ast.File
}

type Package

type Package struct {
	Tables      []Table
	Mixins      []Mixin
	Subrecords  []Subrecord
	ActiveFiles []ActiveFile
	Funcs       map[string][]Func
	// contains filtered or unexported fields
}

func (*Package) Name

func (p *Package) Name() string

func (*Package) OutputTemplates

func (pkg *Package) OutputTemplates()

func (*Package) ParseSrc

func (pkg *Package) ParseSrc(src ...*os.File) error

func (*Package) SetName

func (p *Package) SetName(n string)

func (Package) TableByName

func (p Package) TableByName(tableName string) (Table, bool)

func (*Package) WriteLibraryFiles

func (pkg *Package) WriteLibraryFiles()

func (*Package) WriteStarterFile

func (pkg *Package) WriteStarterFile()

type Relationship

type Relationship struct {
	Table string
	// One of "ParentHasMany", "ChildHasMany", "HasOne", "BelongsTo"
	Type                  string
	IsArray               bool
	Alias                 string
	Parent                Table
	ParentName, ChildName string
	OperativeColumn       string
}

func (Relationship) ColumnName

func (r Relationship) ColumnName() string

func (Relationship) IsBelongsTo

func (r Relationship) IsBelongsTo() bool

func (Relationship) IsChildHasMany

func (r Relationship) IsChildHasMany() bool

func (Relationship) IsHasMany

func (r Relationship) IsHasMany() bool

func (Relationship) IsHasOne

func (r Relationship) IsHasOne() bool

func (Relationship) Name

func (r Relationship) Name() string

type Subrecord

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

func (*Subrecord) AddRetrieved

func (s *Subrecord) AddRetrieved()

func (Subrecord) File

func (t Subrecord) File() *ast.File

func (Subrecord) Name

func (t Subrecord) Name() string

func (Subrecord) Spec

func (t Subrecord) Spec() *ast.TypeSpec

type Table

type Table struct {
	Pkg       *Package
	Relations []Relationship
	Indexes   []Index
	// contains filtered or unexported fields
}

func (Table) ColumnByName

func (t Table) ColumnByName(colName string) (Column, bool)

func (*Table) Columns

func (t *Table) Columns() []Column

func (Table) File

func (t Table) File() *ast.File

func (Table) HasRelationship

func (t Table) HasRelationship(relate string) bool

func (Table) Name

func (t Table) Name() string

func (*Table) PrimaryKeyColumn

func (t *Table) PrimaryKeyColumn() Column

func (Table) RelationshipTo

func (t Table) RelationshipTo(tableName string) (Relationship, bool)

func (Table) Spec

func (t Table) Spec() *ast.TypeSpec

Jump to

Keyboard shortcuts

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