ir

package
v0.0.0-...-06e4aab Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 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 AutoInsert

type AutoInsert struct {
	Value   bool
	Default string
}

type Clause

type Clause struct {
	Left  *Expr
	Op    consts.Operator
	Right *Expr
}

func (*Clause) NeedsCondition

func (c *Clause) NeedsCondition() bool

type Create

type Create struct {
	Suffix   []string
	Model    *Model
	Raw      bool
	NoReturn bool
	Replace  bool
}

func (*Create) Fields

func (cre *Create) Fields() (fields []*Field)

func (*Create) InsertableDynamicFields

func (cre *Create) InsertableDynamicFields() (fields []*Field)

func (*Create) InsertableOptionalFields

func (cre *Create) InsertableOptionalFields() (fields []*Field)

func (*Create) InsertableRequiredFields

func (cre *Create) InsertableRequiredFields() (fields []*Field)

func (*Create) InsertableStaticFields

func (cre *Create) InsertableStaticFields() (fields []*Field)

func (*Create) Signature

func (cre *Create) Signature() string

type Delete

type Delete struct {
	Suffix []string
	Model  *Model
	Joins  []*Join
	Where  []*Where
}

func (*Delete) Distinct

func (d *Delete) Distinct() bool

func (*Delete) Signature

func (r *Delete) Signature() string

type Expr

type Expr struct {
	Null        bool
	Placeholder int
	StringLit   *string
	NumberLit   *string
	BoolLit     *bool
	Field       *Field
	FuncCall    *FuncCall
	Row         []*Field
}

func (*Expr) HasPlaceholder

func (e *Expr) HasPlaceholder() bool

func (*Expr) Nullable

func (e *Expr) Nullable() bool

func (*Expr) Unique

func (e *Expr) Unique() bool

type Field

type Field struct {
	Name       string
	Column     string
	Model      *Model
	Type       consts.FieldType
	Relation   *Relation
	Nullable   bool
	AutoInsert bool
	AutoUpdate bool
	Updatable  bool
	Length     int // Text only
	Default    string
}

func (*Field) ColumnRef

func (f *Field) ColumnRef() string

func (*Field) Insertable

func (f *Field) Insertable() bool

func (*Field) InsertableDynamic

func (f *Field) InsertableDynamic() bool

func (*Field) InsertableOptional

func (f *Field) InsertableOptional() bool

func (*Field) InsertableRequired

func (f *Field) InsertableRequired() bool

func (*Field) InsertableStatic

func (f *Field) InsertableStatic() bool

func (*Field) IsInt

func (f *Field) IsInt() bool

func (*Field) IsTime

func (f *Field) IsTime() bool

func (*Field) ModelOf

func (f *Field) ModelOf() *Model

func (*Field) SelectRefs

func (f *Field) SelectRefs() (refs []string)

func (*Field) UnderRef

func (f *Field) UnderRef() string

func (*Field) Unique

func (f *Field) Unique() bool

type FuncCall

type FuncCall struct {
	Name string
	Args []*Expr
}

func (*FuncCall) HasPlaceholder

func (fc *FuncCall) HasPlaceholder() bool

func (*FuncCall) Nullable

func (fc *FuncCall) Nullable() bool

type GroupBy

type GroupBy struct {
	Fields []*Field
}

type Index

type Index struct {
	Name    string
	Model   *Model
	Fields  []*Field
	Unique  bool
	Where   []*Where
	Storing []*Field
}

type Join

type Join struct {
	Type  consts.JoinType
	Left  *Field
	Right *Field
}

type Model

type Model struct {
	Name       string
	Table      string
	Fields     []*Field
	PrimaryKey []*Field
	Unique     [][]*Field
	Indexes    []*Index
}

func SortModels

func SortModels(models []*Model) (sorted []*Model, err error)

func (*Model) AutoUpdatableFields

func (m *Model) AutoUpdatableFields() (fields []*Field)

func (*Model) BasicPrimaryKey

func (m *Model) BasicPrimaryKey() *Field

func (*Model) FieldSetUnique

func (m *Model) FieldSetUnique(fields []*Field) bool

func (*Model) FieldUnique

func (m *Model) FieldUnique(field *Field) bool

func (*Model) HasUpdatableFields

func (m *Model) HasUpdatableFields() bool

func (*Model) InsertableDynamicFields

func (m *Model) InsertableDynamicFields() (fields []*Field)

func (*Model) InsertableOptionalFields

func (m *Model) InsertableOptionalFields() (fields []*Field)

func (*Model) InsertableRequiredFields

func (m *Model) InsertableRequiredFields() (fields []*Field)

func (*Model) InsertableStaticFields

func (m *Model) InsertableStaticFields() (fields []*Field)

func (*Model) ModelOf

func (m *Model) ModelOf() *Model

func (*Model) SelectRefs

func (m *Model) SelectRefs() (refs []string)

func (*Model) UnderRef

func (m *Model) UnderRef() string

func (*Model) UpdatableFields

func (m *Model) UpdatableFields() (fields []*Field)

type OrderBy

type OrderBy struct {
	Entries []*OrderByEntry
}

type OrderByEntry

type OrderByEntry struct {
	Field      *Field
	Descending bool
}

type Read

type Read struct {
	Suffix      []string
	Selectables []Selectable
	From        *Model
	Joins       []*Join
	Where       []*Where
	OrderBy     *OrderBy
	GroupBy     *GroupBy
	View        View
}

func (*Read) Distinct

func (r *Read) Distinct() bool

func (*Read) SelectedModel

func (r *Read) SelectedModel() *Model

SelectedModel returns the single model being selected or nil if there are more than one selectable or the selectable is a field.

func (*Read) Signature

func (r *Read) Signature() string

type Relation

type Relation struct {
	Field *Field
	Kind  consts.RelationKind
}

type Root

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

type Selectable

type Selectable interface {
	SelectRefs() []string
	ModelOf() *Model
	// contains filtered or unexported methods
}

type Update

type Update struct {
	Suffix   []string
	Model    *Model
	Joins    []*Join
	Where    []*Where
	NoReturn bool
}

func (*Update) AutoUpdatableFields

func (upd *Update) AutoUpdatableFields() (fields []*Field)

func (*Update) One

func (upd *Update) One() bool

func (*Update) Signature

func (r *Update) Signature() string

type View

type View string
const (
	All         View = "all"
	LimitOffset View = "limitoffset"
	Paged       View = "paged"
	Count       View = "count"
	Has         View = "has"
	Scalar      View = "scalar"
	One         View = "one"
	First       View = "first"
)

type Where

type Where struct {
	Clause *Clause
	Or     *[2]*Where
	And    *[2]*Where
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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