parser

package
v0.0.0-...-fc73e00 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2016 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Path           string
	Version        string
	GoratorVersion string

	Packages map[string]*Package

	Databases []*Database

	EncodingJSON          bool
	EncodingJSONOmitEmpty bool
	EncodingJSONUseStdLib bool
	EncodingXML           bool
	EncodingXMLOmitEmpty  bool
	EncodingXMLUseStdLib  bool
}

func Parse

func Parse(path string, configs ...[]byte) (*Config, error)

func (*Config) GetAllModels

func (c *Config) GetAllModels() (s []*Model)

func (*Config) GetAllTables

func (c *Config) GetAllTables() (s []*Table)

func (*Config) GetDrivers

func (c *Config) GetDrivers() (s []string)

func (*Config) GetModel

func (c *Config) GetModel(name string) *Model

func (*Config) GetModels

func (c *Config) GetModels() (s []*Model)

func (*Config) GetPackage

func (c *Config) GetPackage(name string) (p *Package)

func (*Config) GetPivotModels

func (c *Config) GetPivotModels() (s []*Model)

func (*Config) GetPivotTables

func (c *Config) GetPivotTables() (s []*Table)

func (*Config) GetPrimaryKeys

func (c *Config) GetPrimaryKeys() (s []*PrimaryKey)

func (*Config) GetSchemas

func (c *Config) GetSchemas() (s []*Schema)

func (*Config) GetTables

func (c *Config) GetTables() (s []*Table)

type Database

type Database struct {
	Config     *Config
	Name       string
	DriverName string
	Driver     driver.Driver
	Models     []*Model
	Tables     []*Table
}

func (*Database) GetAllModels

func (d *Database) GetAllModels() (s []*Model)

func (*Database) GetAllTables

func (d *Database) GetAllTables() (s []*Table)

func (*Database) GetModels

func (d *Database) GetModels() (s []*Model)

func (*Database) GetPivotModels

func (d *Database) GetPivotModels() (s []*Model)

func (*Database) GetPivotTables

func (d *Database) GetPivotTables() (s []*Table)

func (*Database) GetPrimaryKeys

func (d *Database) GetPrimaryKeys() (s []*PrimaryKey)

func (*Database) GetSchemas

func (d *Database) GetSchemas() (s []*Schema)

func (*Database) GetTables

func (d *Database) GetTables() (s []*Table)

type Field

type Field struct {
	Model          *Model
	Name           string
	NameInDB       string
	Type           string
	TypeInDB       string
	NameInEncoding string

	Default interface{}

	Validations []string

	Callbacks []string

	Array        bool
	Null         bool
	Unique       bool
	Numeric      bool
	Incrementing bool
	InDB         bool
	Exported     bool
	InEncoding   bool
	Primitive    bool

	Where   bool
	OrderBy bool
	GroupBy bool
	Having  bool
}

type List

type List struct {
	Model *Model
	Linq  bool
}

type Model

type Model struct {
	Database *Database

	SuperModel *SuperModel
	Name       string
	Table      *Table
	Fields     []*Field
	Relations  []*Relation

	PrimaryKey *PrimaryKey

	CreatedAt bool
	UpdatedAt bool
	DeletedAt bool
	CreatedBy bool
	UpdatedBy bool
	DeletedBy bool

	Callbacks []string

	HoldOriginal bool
	SoftDelete   bool
	AllowExtra   bool

	Uuid   int
	Listed bool
	List   *List

	IsPivot bool

	EncodingJSON          bool
	EncodingJSONOmitEmpty bool
	EncodingJSONUseStdLib bool
	EncodingXML           bool
	EncodingXMLOmitEmpty  bool
	EncodingXMLUseStdLib  bool
}

type Package

type Package struct {
	Config      *Config
	Name        string
	Description string
	Path        string
	Imports     []map[string]string
}

type PrimaryKey

type PrimaryKey struct {
	Model  *Model
	Fields []string
}

func (*PrimaryKey) GetFields

func (p *PrimaryKey) GetFields() []*Field

type Relation

type Relation struct {
	Model          *Model
	Name           string
	NameInEncoding string
	OtherModelName string
	OtherModel     *Model
	Type           string
	ForeignKey     string
	LocalKey       string
	OtherKey       string
	PivotName      string
	Query          map[string]interface{}
	// following is for belongsToMany relations
	// OtherForeignKey []string
	// Key             []string
	Pivot *Model
}

type Schema

type Schema struct {
	Name     string
	Database *Database
	Tables   []*Table
}

type SuperModel

type SuperModel struct {
	Name       string
	Table      *Table
	Fields     []*Field
	Relations  []*Relation
	SoftDelete bool

	CreatedAt bool
	UpdatedAt bool
	DeletedAt bool
	CreatedBy bool
	UpdatedBy bool
	DeletedBy bool

	Uuid int
}

type Table

type Table struct {
	Name   string
	Schema string
	Model  *Model

	IsPivot bool
}

Jump to

Keyboard shortcuts

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