ast

package
v0.0.0-...-ab26969 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool

type Bool struct {
	Pos   scanner.Position
	Value bool
}

func (*Bool) Get

func (b *Bool) Get() bool

func (*Bool) String

func (b *Bool) String() string

type Create

type Create struct {
	Pos      scanner.Position
	Model    *ModelRef
	Raw      *Bool
	NoReturn *Bool
	Suffix   *Suffix
}

type Delete

type Delete struct {
	Pos    scanner.Position
	Model  *ModelRef
	Joins  []*Join
	Where  []*Where
	Suffix *Suffix
}

type Expr

type Expr struct {
	Pos scanner.Position
	// The following fields are mutually exclusive
	Null        *Null
	StringLit   *String
	NumberLit   *String
	BoolLit     *Bool
	Placeholder *Placeholder
	FieldRef    *FieldRef
	FuncCall    *FuncCall
}

func (*Expr) String

func (e *Expr) String() string

type Field

type Field struct {
	Pos  scanner.Position
	Name *String

	// Common to both regular and relation fields
	Column    *String
	Nullable  *Bool
	Updatable *Bool

	// Only make sense on a regular field
	Type       *FieldType
	AutoInsert *Bool
	AutoUpdate *Bool
	Length     *Int

	// Only make sense on a relation
	Relation     *FieldRef
	RelationKind *RelationKind
}

type FieldRef

type FieldRef struct {
	Pos   scanner.Position
	Model *String
	Field *String
}

func (*FieldRef) ModelRef

func (f *FieldRef) ModelRef() *ModelRef

func (*FieldRef) Relative

func (f *FieldRef) Relative() *RelativeFieldRef

func (*FieldRef) String

func (r *FieldRef) String() string

type FieldRefs

type FieldRefs struct {
	Pos  scanner.Position
	Refs []*FieldRef
}

type FieldType

type FieldType struct {
	Pos   scanner.Position
	Value consts.FieldType
}

type FuncCall

type FuncCall struct {
	Pos  scanner.Position
	Name *String
	Args []*Expr
}

func (*FuncCall) String

func (f *FuncCall) String() string

type Index

type Index struct {
	Pos    scanner.Position
	Name   *String
	Fields *RelativeFieldRefs
	Unique *Bool
}

type Int

type Int struct {
	Pos   scanner.Position
	Value int
}

func (*Int) Get

func (i *Int) Get() int

type Join

type Join struct {
	Pos   scanner.Position
	Left  *FieldRef
	Right *FieldRef
	Type  *JoinType
}

type JoinType

type JoinType struct {
	Pos   scanner.Position
	Value consts.JoinType
}

func (*JoinType) Get

func (j *JoinType) Get() consts.JoinType

type Model

type Model struct {
	Pos        scanner.Position
	Name       *String
	Table      *String
	Fields     []*Field
	PrimaryKey *RelativeFieldRefs
	Unique     []*RelativeFieldRefs
	Indexes    []*Index
}

type ModelRef

type ModelRef struct {
	Pos   scanner.Position
	Model *String
}

func (*ModelRef) String

func (m *ModelRef) String() string

type Null

type Null struct {
	Pos scanner.Position
}

func (*Null) String

func (p *Null) String() string

type Operator

type Operator struct {
	Pos   scanner.Position
	Value consts.Operator
}

func (*Operator) String

func (o *Operator) String() string

type OrderBy

type OrderBy struct {
	Pos        scanner.Position
	Fields     *FieldRefs
	Descending *Bool
}

type Placeholder

type Placeholder struct {
	Pos scanner.Position
}

func (*Placeholder) String

func (p *Placeholder) String() string

type Read

type Read struct {
	Pos     scanner.Position
	Select  *FieldRefs
	Joins   []*Join
	Where   []*Where
	OrderBy *OrderBy
	View    *View
	Suffix  *Suffix
}

type RelationKind

type RelationKind struct {
	Pos   scanner.Position
	Value consts.RelationKind
}

type RelativeFieldRef

type RelativeFieldRef struct {
	Pos   scanner.Position
	Field *String
}

func (*RelativeFieldRef) String

func (r *RelativeFieldRef) String() string

type RelativeFieldRefs

type RelativeFieldRefs struct {
	Pos  scanner.Position
	Refs []*RelativeFieldRef
}

type Root

type Root struct {
	Models  []*Model
	Creates []*Create
	Reads   []*Read
	Updates []*Update
	Deletes []*Delete
}

type String

type String struct {
	Pos   scanner.Position
	Value string
}

func (*String) Get

func (s *String) Get() string

type Suffix

type Suffix struct {
	Pos   scanner.Position
	Parts []*String
}

type Update

type Update struct {
	Pos      scanner.Position
	Model    *ModelRef
	Joins    []*Join
	Where    []*Where
	NoReturn *Bool
	Suffix   *Suffix
}

type View

type View struct {
	Pos         scanner.Position
	All         *Bool
	LimitOffset *Bool
	Paged       *Bool
	Count       *Bool
	Has         *Bool
	Scalar      *Bool
	One         *Bool
	First       *Bool
}

type Where

type Where struct {
	Pos   scanner.Position
	Left  *Expr
	Op    *Operator
	Right *Expr
}

func (*Where) String

func (w *Where) String() string

Jump to

Keyboard shortcuts

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