Documentation ¶
Index ¶
- Variables
- func RenderCode(w io.Writer, schema *Schema, dialects []Dialect, lang Language) (err error)
- func RenderTemplate(tmpl *template.Template, w io.Writer, name string, data interface{}) error
- func RenderTemplateString(tmpl *template.Template, name string, data interface{}) (string, error)
- type BinLoader
- type Column
- type ColumnCmpColumnParams
- type ColumnCmpParams
- type ColumnInParams
- type ConditionParams
- type DeleteParams
- type Dialect
- type DirLoader
- type InsertParams
- type Join
- type JoinParams
- type Language
- type Loader
- type LoaderFunc
- type Query
- type Relation
- type RelationKind
- type Schema
- type SelectParams
- type Table
- func (t *Table) BasicPrimaryKey() *Column
- func (t *Table) ColumnSetUnique(columns []*Column) bool
- func (t *Table) Depth() (depth int)
- func (t *Table) GetColumn(name string) *Column
- func (t *Table) GetColumns(names ...string) (out []*Column)
- func (t *Table) InsertableColumns() (out []*Column)
- func (t *Table) Updatable() bool
- func (t *Table) UpdatableBy() (out [][]*Column)
- func (t *Table) UpdatableColumns() (out []*Column)
- type UpdateParams
Constants ¶
This section is empty.
Variables ¶
View Source
var Error = errors.NewClass("dbx")
Functions ¶
func RenderCode ¶
func RenderTemplate ¶
Types ¶
type Column ¶
type Column struct { Table *Table Name string Type string NotNull bool Relation *Relation Updatable bool AutoInsert bool AutoUpdate bool }
func (*Column) Insertable ¶
func (*Column) RelationLeft ¶
func (*Column) RelationRight ¶
type ColumnCmpColumnParams ¶
type ColumnCmpParams ¶
type ColumnInParams ¶
type ColumnInParams struct { Left *Column In *SelectParams }
type ConditionParams ¶
type ConditionParams struct { ColumnCmp *ColumnCmpParams ColumnCmpColumn *ColumnCmpColumnParams ColumnIn *ColumnInParams }
func ColumnEquals ¶
func ColumnEquals(left *Column) *ConditionParams
func ColumnEqualsColumn ¶
func ColumnEqualsColumn(left, right *Column) *ConditionParams
func ColumnIn ¶
func ColumnIn(left *Column, in *SelectParams) *ConditionParams
func Where ¶
func Where(conditions ...*ConditionParams) []*ConditionParams
type DeleteParams ¶
type DeleteParams struct { Many bool Table *Table Conditions []*ConditionParams }
type Dialect ¶
type Dialect interface { Name() string RenderSchema(schema *Schema) (string, error) RenderSelect(params *SelectParams) (string, error) RenderCount(params *SelectParams) (string, error) RenderDelete(params *DeleteParams) (string, error) RenderInsert(params *InsertParams) (string, error) RenderUpdate(params *UpdateParams) (string, error) SupportsReturning() bool }
type InsertParams ¶
type JoinParams ¶
func Joins ¶
func Joins(joins ...*Join) (out []*JoinParams)
type Language ¶
type Language interface { Name() string RenderHeader(w io.Writer, dialects []Dialect, schema *Schema) error RenderSelect(w io.Writer, dialects []Dialect, params *SelectParams) error RenderCount(w io.Writer, dialects []Dialect, params *SelectParams) error RenderDelete(w io.Writer, dialects []Dialect, params *DeleteParams) error RenderInsert(w io.Writer, dialects []Dialect, params *InsertParams) error RenderUpdate(w io.Writer, dialects []Dialect, params *UpdateParams) error Format([]byte) ([]byte, error) }
type LoaderFunc ¶
type Relation ¶
type Relation struct { Column *Column Kind RelationKind }
type RelationKind ¶
type RelationKind string
const ( HasA RelationKind = "has_a" OwnedBy RelationKind = "owned_by" )
type Schema ¶
func LoadSchema ¶
type SelectParams ¶
type SelectParams struct { Many bool What []*Column Table *Table LeftJoins []*JoinParams Conditions []*ConditionParams PagedOn *Column }
type Table ¶
func (*Table) BasicPrimaryKey ¶
func (*Table) ColumnSetUnique ¶
func (*Table) GetColumns ¶
func (*Table) InsertableColumns ¶
func (*Table) UpdatableBy ¶
func (*Table) UpdatableColumns ¶
type UpdateParams ¶
type UpdateParams struct { Table *Table Conditions []*ConditionParams }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.