query

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildWhereSQL

func BuildWhereSQL(d core.Dialect, values []core.Expression) (core.SQL, error)

func CombinePathSQL

func CombinePathSQL(d core.Dialect, paths []core.Expression) (core.SQL, error)

CombinePathSQL will validate each path is not nil, and will append n+1 with a comma separating them

func CombineSQL

func CombineSQL(d core.Dialect, paths []core.Expression) (core.SQL, error)

CombineSQL will validate each path is not nil, and will append each SQL to the previous with a single space between each.

func ExpandTables

func ExpandTables(paths []core.Expression) []core.Expression

func NewNamedOnlyColumn

func NewNamedOnlyColumn(name, parent string) *stringColumn

NewNamedOnlyColumn creates a `core.Column` of which only the name of the column is filled out. Thus, when `GetSQL()` is called, only a single SQL with the value of `name` is returned.

Types

type DeleteQuery

type DeleteQuery struct {
	// contains filtered or unexported fields
}

func Delete

func Delete(t core.Table) *DeleteQuery

Delete allows deletion of an entity

func (DeleteQuery) GetSQL

func (d DeleteQuery) GetSQL(dialect core.Dialect) (core.SQL, error)

func (DeleteQuery) Join

DELETE w FROM WorkRecord2 w LEFT JOIN Employee e ON EmployeeRun=EmployeeNo WHERE w.Company = '1' AND e.Date = '2013-05-06'

func (DeleteQuery) Where

func (d DeleteQuery) Where(exp ...core.Expression) *DeleteQuery

type InsertQuery

type InsertQuery struct {
	// contains filtered or unexported fields
}

func InsertInto

func InsertInto(entity core.Table) *InsertQuery

func (*InsertQuery) Columns

func (i *InsertQuery) Columns(columns ...core.Column) *InsertQuery

func (*InsertQuery) GetSQL

func (i *InsertQuery) GetSQL(d core.Dialect) (core.SQL, error)

func (*InsertQuery) Select

func (i *InsertQuery) Select(s *SelectQuery) *InsertQuery

Select allows passing in a Select Query the following insert statements:

INSERT INTO table1 (uuid, name) SELECT UNHEX("1234567891230"), a.name FROM table2 as a LEFT JOIN table1 as b ON a.name=b.remote_name WHERE b.remote_name = 'other_table';

func (*InsertQuery) Values

func (i *InsertQuery) Values(values ...core.Expression) *InsertQuery

Values allows inserting expressions with SQL functions:

INSERT INTO table1 (uuid, name) values (UNHEX("1234567891234"), 'name1');

func (*InsertQuery) ValuesConstants

func (i *InsertQuery) ValuesConstants(values ...interface{}) *InsertQuery

ValuesConstants allows inserting constant values:

INSERT INTO table1 (id, name, internal_name) values (123456, 'name1', 'internal_name');

type Modifier

type Modifier struct {
	Limit  int
	Offset int
}

type SelectQuery

type SelectQuery struct {
	// contains filtered or unexported fields
}

func Select

func Select(paths ...core.Expression) *SelectQuery

func SelectFrom

func SelectFrom(e core.Table) *SelectQuery

func (*SelectQuery) From

func (s *SelectQuery) From(e core.Table) *SelectQuery

func (*SelectQuery) GetSQL

func (s *SelectQuery) GetSQL(d core.Dialect) (core.SQL, error)

func (*SelectQuery) Join

func (*SelectQuery) OrderBy

func (s *SelectQuery) OrderBy(exp core.Expression, direction sort.Direction) *SelectQuery

func (*SelectQuery) Where

func (s *SelectQuery) Where(exp ...core.Expression) *SelectQuery

type UpdateQuery

type UpdateQuery struct {
	// contains filtered or unexported fields
}

func Update

func Update(table core.Table) *UpdateQuery

func (UpdateQuery) GetSQL

func (u UpdateQuery) GetSQL(d core.Dialect) (core.SQL, error)

func (UpdateQuery) Set

func (u UpdateQuery) Set(exp ...core.Set) *UpdateQuery

func (UpdateQuery) Where

func (u UpdateQuery) Where(exp ...core.Expression) *UpdateQuery

Jump to

Keyboard shortcuts

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