db.v3: upper.io/db.v3/internal/sqladapter/exql Index | Files

package exql

import "upper.io/db.v3/internal/sqladapter/exql"

Index

Package Files

column.go column_value.go columns.go database.go default.go group_by.go hash.go interfaces.go join.go order_by.go raw.go returning.go statement.go table.go template.go utilities.go value.go where.go

Constants

const (
    DefaultOrder = Order(iota)
    Ascendent
    Descendent
)

Possible values for Order

const (
    NoOp = Type(iota)

    Truncate
    DropTable
    DropDatabase
    Count
    Insert
    Select
    Update
    Delete

    SQL
)

Values for Type.

type And Uses

type And Where

And represents an SQL AND operator.

func JoinWithAnd Uses

func JoinWithAnd(conditions ...Fragment) *And

JoinWithAnd creates and returns a new And.

func (*And) Compile Uses

func (a *And) Compile(layout *Template) (compiled string, err error)

Compile transforms the And into an equivalent SQL representation.

func (*And) Hash Uses

func (a *And) Hash() string

Hash returns a unique identifier.

type Column Uses

type Column struct {
    Name  interface{}
    Alias string
    // contains filtered or unexported fields
}

Column represents a SQL column.

func ColumnWithName Uses

func ColumnWithName(name string) *Column

ColumnWithName creates and returns a Column with the given name.

func (*Column) Compile Uses

func (c *Column) Compile(layout *Template) (compiled string, err error)

Compile transforms the ColumnValue into an equivalent SQL representation.

func (*Column) Hash Uses

func (c *Column) Hash() string

Hash returns a unique identifier for the struct.

type ColumnValue Uses

type ColumnValue struct {
    Column   Fragment
    Operator string
    Value    Fragment
    // contains filtered or unexported fields
}

ColumnValue represents a bundle between a column and a corresponding value.

func (*ColumnValue) Compile Uses

func (c *ColumnValue) Compile(layout *Template) (compiled string, err error)

Compile transforms the ColumnValue into an equivalent SQL representation.

func (*ColumnValue) Hash Uses

func (c *ColumnValue) Hash() string

Hash returns a unique identifier for the struct.

type ColumnValues Uses

type ColumnValues struct {
    ColumnValues []Fragment
    // contains filtered or unexported fields
}

ColumnValues represents an array of ColumnValue

func JoinColumnValues Uses

func JoinColumnValues(values ...Fragment) *ColumnValues

JoinColumnValues returns an array of ColumnValue

func (*ColumnValues) Compile Uses

func (c *ColumnValues) Compile(layout *Template) (compiled string, err error)

Compile transforms the ColumnValues into its SQL representation.

func (*ColumnValues) Hash Uses

func (c *ColumnValues) Hash() string

Hash returns a unique identifier for the struct.

func (*ColumnValues) Insert Uses

func (c *ColumnValues) Insert(values ...Fragment) *ColumnValues

Insert adds a column to the columns array.

type Columns Uses

type Columns struct {
    Columns []Fragment
    // contains filtered or unexported fields
}

Columns represents an array of Column.

func JoinColumns Uses

func JoinColumns(columns ...Fragment) *Columns

JoinColumns creates and returns an array of Column.

func (*Columns) Append Uses

func (c *Columns) Append(a *Columns) *Columns

func (*Columns) Compile Uses

func (c *Columns) Compile(layout *Template) (compiled string, err error)

Compile transforms the Columns into an equivalent SQL representation.

func (*Columns) Hash Uses

func (c *Columns) Hash() string

Hash returns a unique identifier.

type Database Uses

type Database struct {
    Name string
    // contains filtered or unexported fields
}

Database represents a SQL database.

func DatabaseWithName Uses

func DatabaseWithName(name string) *Database

DatabaseWithName returns a Database with the given name.

func (*Database) Compile Uses

func (d *Database) Compile(layout *Template) (compiled string, err error)

Compile transforms the Database into an equivalent SQL representation.

func (*Database) Hash Uses

func (d *Database) Hash() string

Hash returns a unique identifier for the struct.

type Fragment Uses

type Fragment interface {
    cache.Hashable
    // contains filtered or unexported methods
}

Fragment is any interface that can be both cached and compiled.

type GroupBy Uses

type GroupBy struct {
    Columns Fragment
    // contains filtered or unexported fields
}

GroupBy represents a SQL's "group by" statement.

func GroupByColumns Uses

func GroupByColumns(columns ...Fragment) *GroupBy

GroupByColumns creates and returns a GroupBy with the given column.

func (*GroupBy) Compile Uses

func (g *GroupBy) Compile(layout *Template) (compiled string, err error)

Compile transforms the GroupBy into an equivalent SQL representation.

func (*GroupBy) Hash Uses

func (g *GroupBy) Hash() string

Hash returns a unique identifier.

type Join Uses

type Join struct {
    Type  string
    Table Fragment
    On    Fragment
    Using Fragment
    // contains filtered or unexported fields
}

Join represents a generic JOIN statement.

func (*Join) Compile Uses

func (j *Join) Compile(layout *Template) (compiled string, err error)

Compile transforms the Join into its equivalent SQL representation.

func (*Join) Hash Uses

func (j *Join) Hash() string

Hash returns a unique identifier for the struct.

type Joins Uses

type Joins struct {
    Conditions []Fragment
    // contains filtered or unexported fields
}

Joins represents the union of different join conditions.

func JoinConditions Uses

func JoinConditions(joins ...*Join) *Joins

JoinConditions creates a Joins object.

func (*Joins) Compile Uses

func (j *Joins) Compile(layout *Template) (compiled string, err error)

Compile transforms the Where into an equivalent SQL representation.

func (*Joins) Hash Uses

func (j *Joins) Hash() string

Hash returns a unique identifier for the struct.

type Limit Uses

type Limit int

Limit represents the SQL limit in a query.

type Offset Uses

type Offset int

Offset represents the SQL offset in a query.

type On Uses

type On Where

On represents JOIN conditions.

func OnConditions Uses

func OnConditions(conditions ...Fragment) *On

OnConditions creates and retuens a new On.

func (*On) Compile Uses

func (o *On) Compile(layout *Template) (compiled string, err error)

Compile transforms the On into an equivalent SQL representation.

func (*On) Hash Uses

func (o *On) Hash() string

Hash returns a unique identifier.

type Or Uses

type Or Where

Or represents an SQL OR operator.

func JoinWithOr Uses

func JoinWithOr(conditions ...Fragment) *Or

JoinWithOr creates and returns a new Or.

func (*Or) Compile Uses

func (o *Or) Compile(layout *Template) (compiled string, err error)

Compile transforms the Or into an equivalent SQL representation.

func (*Or) Hash Uses

func (o *Or) Hash() string

Hash returns a unique identifier.

type Order Uses

type Order uint8

Order represents the order in which SQL results are sorted.

func (Order) Compile Uses

func (s Order) Compile(layout *Template) (string, error)

Compile transforms the SortColumn into an equivalent SQL representation.

func (*Order) Hash Uses

func (s *Order) Hash() string

Hash returns a unique identifier.

type OrderBy Uses

type OrderBy struct {
    SortColumns Fragment
    // contains filtered or unexported fields
}

OrderBy represents an ORDER BY clause.

func JoinWithOrderBy Uses

func JoinWithOrderBy(sc *SortColumns) *OrderBy

JoinWithOrderBy creates an returns an OrderBy using the given SortColumns.

func (*OrderBy) Compile Uses

func (s *OrderBy) Compile(layout *Template) (compiled string, err error)

Compile transforms the SortColumn into an equivalent SQL representation.

func (*OrderBy) Hash Uses

func (s *OrderBy) Hash() string

Hash returns a unique identifier for the struct.

type Raw Uses

type Raw struct {
    Value string // Value should not be modified after assigned.
    // contains filtered or unexported fields
}

Raw represents a value that is meant to be used in a query without escaping.

func RawValue Uses

func RawValue(v string) *Raw

RawValue creates and returns a new raw value.

func (*Raw) Compile Uses

func (r *Raw) Compile(*Template) (string, error)

Compile returns the raw value.

func (*Raw) Hash Uses

func (r *Raw) Hash() string

Hash returns a unique identifier for the struct.

func (*Raw) String Uses

func (r *Raw) String() string

String returns the raw value.

type Returning Uses

type Returning struct {
    *Columns
    // contains filtered or unexported fields
}

Returning represents a RETURNING clause.

func ReturningColumns Uses

func ReturningColumns(columns ...Fragment) *Returning

ReturningColumns creates and returns an array of Column.

func (*Returning) Compile Uses

func (r *Returning) Compile(layout *Template) (compiled string, err error)

Compile transforms the clause into its equivalent SQL representation.

func (*Returning) Hash Uses

func (r *Returning) Hash() string

Hash returns a unique identifier for the struct.

type SortColumn Uses

type SortColumn struct {
    Column Fragment
    Order
    // contains filtered or unexported fields
}

SortColumn represents the column-order relation in an ORDER BY clause.

func (*SortColumn) Compile Uses

func (s *SortColumn) Compile(layout *Template) (compiled string, err error)

Compile transforms the SortColumn into an equivalent SQL representation.

func (*SortColumn) Hash Uses

func (s *SortColumn) Hash() string

Hash returns a unique identifier for the struct.

type SortColumns Uses

type SortColumns struct {
    Columns []Fragment
    // contains filtered or unexported fields
}

SortColumns represents the columns in an ORDER BY clause.

func JoinSortColumns Uses

func JoinSortColumns(values ...Fragment) *SortColumns

JoinSortColumns creates and returns an array of column-order relations.

func (*SortColumns) Compile Uses

func (s *SortColumns) Compile(layout *Template) (compiled string, err error)

Compile transforms the SortColumns into an equivalent SQL representation.

func (*SortColumns) Hash Uses

func (s *SortColumns) Hash() string

Hash returns a unique identifier for the struct.

type Statement Uses

type Statement struct {
    Type
    Table        Fragment
    Database     Fragment
    Columns      Fragment
    Values       Fragment
    Distinct     bool
    ColumnValues Fragment
    OrderBy      Fragment
    GroupBy      Fragment
    Joins        Fragment
    Where        Fragment
    Returning    Fragment

    Limit
    Offset

    SQL string
    // contains filtered or unexported fields
}

Statement represents different kinds of SQL statements.

func RawSQL Uses

func RawSQL(s string) *Statement

RawSQL represents a raw SQL statement.

func (*Statement) Amend Uses

func (s *Statement) Amend(in string) string

func (*Statement) Compile Uses

func (s *Statement) Compile(layout *Template) (compiled string, err error)

Compile transforms the Statement into an equivalent SQL query.

func (*Statement) Hash Uses

func (s *Statement) Hash() string

Hash returns a unique identifier for the struct.

func (*Statement) SetAmendment Uses

func (s *Statement) SetAmendment(amendFn func(string) string)

type Table Uses

type Table struct {
    Name interface{}
    // contains filtered or unexported fields
}

Table struct represents a SQL table.

func TableWithName Uses

func TableWithName(name string) *Table

TableWithName creates an returns a Table with the given name.

func (*Table) Compile Uses

func (t *Table) Compile(layout *Template) (compiled string, err error)

Compile transforms a table struct into a SQL chunk.

func (*Table) Hash Uses

func (t *Table) Hash() string

Hash returns a string hash of the table value.

type Template Uses

type Template struct {
    AndKeyword          string
    AscKeyword          string
    AssignmentOperator  string
    ClauseGroup         string
    ClauseOperator      string
    ColumnAliasLayout   string
    ColumnSeparator     string
    ColumnValue         string
    CountLayout         string
    DeleteLayout        string
    DescKeyword         string
    DropDatabaseLayout  string
    DropTableLayout     string
    GroupByLayout       string
    IdentifierQuote     string
    IdentifierSeparator string
    InsertLayout        string
    JoinLayout          string
    OnLayout            string
    OrKeyword           string
    OrderByLayout       string
    SelectLayout        string
    SortByColumnLayout  string
    TableAliasLayout    string
    TruncateLayout      string
    UpdateLayout        string
    UsingLayout         string
    ValueQuote          string
    ValueSeparator      string
    WhereLayout         string

    ComparisonOperator map[db.ComparisonOperator]string

    *cache.Cache
}

Template is an SQL template.

type Type Uses

type Type uint

Type is the type of SQL query the statement represents.

type Using Uses

type Using Columns

Using represents a USING function.

func UsingColumns Uses

func UsingColumns(columns ...Fragment) *Using

UsingColumns builds a Using from the given columns.

func (*Using) Compile Uses

func (u *Using) Compile(layout *Template) (compiled string, err error)

Compile transforms the Using into an equivalent SQL representation.

func (*Using) Hash Uses

func (u *Using) Hash() string

Hash returns a unique identifier.

type Value Uses

type Value struct {
    V interface{}
    // contains filtered or unexported fields
}

Value represents an escaped SQL value.

func NewValue Uses

func NewValue(v interface{}) *Value

NewValue creates and returns a Value.

func (*Value) Compile Uses

func (v *Value) Compile(layout *Template) (compiled string, err error)

Compile transforms the Value into an equivalent SQL representation.

func (*Value) Hash Uses

func (v *Value) Hash() string

Hash returns a unique identifier for the struct.

type ValueGroups Uses

type ValueGroups struct {
    Values []*Values
    // contains filtered or unexported fields
}

ValueGroups represents an array of value groups.

func JoinValueGroups Uses

func JoinValueGroups(values ...*Values) *ValueGroups

JoinValueGroups creates a new *ValueGroups object.

func (*ValueGroups) Compile Uses

func (vg *ValueGroups) Compile(layout *Template) (compiled string, err error)

Compile transforms the ValueGroups into an equivalent SQL representation.

func (*ValueGroups) Hash Uses

func (vg *ValueGroups) Hash() string

Hash returns a unique identifier for the struct.

type Values Uses

type Values struct {
    Values []Fragment
    // contains filtered or unexported fields
}

Values represents an array of Value.

func NewValueGroup Uses

func NewValueGroup(v ...Fragment) *Values

NewValueGroup creates and returns an array of values.

func (*Values) Compile Uses

func (vs *Values) Compile(layout *Template) (compiled string, err error)

Compile transforms the Values into an equivalent SQL representation.

func (*Values) Hash Uses

func (vs *Values) Hash() string

Hash returns a unique identifier for the struct.

type Where Uses

type Where struct {
    Conditions []Fragment
    // contains filtered or unexported fields
}

Where represents an SQL WHERE clause.

func WhereConditions Uses

func WhereConditions(conditions ...Fragment) *Where

WhereConditions creates and retuens a new Where.

func (*Where) Append Uses

func (w *Where) Append(a *Where) *Where

Appends adds the conditions to the ones that already exist.

func (*Where) Compile Uses

func (w *Where) Compile(layout *Template) (compiled string, err error)

Compile transforms the Where into an equivalent SQL representation.

func (*Where) Hash Uses

func (w *Where) Hash() string

Hash returns a unique identifier for the struct.

Package exql imports 10 packages (graph) and is imported by 7 packages. Updated 2018-09-30. Refresh now. Tools for package owners.