Documentation
¶
Index ¶
- type AddColumnStatement
- type AddUnique
- type CreateIndexStatement
- type CreateStatement
- type DeleteStatement
- type DropIndex
- type DropTable
- type ILoadEntityStatement
- type IPreparedLoadEntityStatement
- type InsertLoad
- type InsertStatement
- type JoinType
- type LoadEntityStatement
- func (statement *LoadEntityStatement) Alias(alias string) ILoadEntityStatement
- func (statement *LoadEntityStatement) Join(jointype JoinType, table string, predicate interface{}, alias string)
- func (statement *LoadEntityStatement) Prepare() IPreparedLoadEntityStatement
- func (statement *LoadEntityStatement) Where(predicate interface{}) ILoadEntityStatement
- type LoadStatement
- func (statement *LoadStatement) Columns(columns []*models.ColumnDescriptor) *LoadStatement
- func (statement *LoadStatement) Fields(fields ...interface{}) *LoadStatement
- func (statement *LoadStatement) Prepare() *PreparedLoadStatement
- func (statement *LoadStatement) Where(predicate interface{}) *LoadStatement
- type PreparedLoadEntityStatement
- type PreparedLoadStatement
- type PreparedStatement
- type RenameTable
- type UpdateStatement
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddColumnStatement ¶
type AddColumnStatement struct {
// contains filtered or unexported fields
}
AddColumnStatement statement used to add a column to a table
func NewAddColumnStatement ¶
func NewAddColumnStatement(connection *sql.DB, connectioninfo connection.IConnectionInfo, model *models.EntityModel, column *models.ColumnDescriptor) *AddColumnStatement
NewAddColumnStatement creates a new AddColumnStatement
**Parameters**
- connection: connection used to execute sql statement
- connectioninfo: driver specific connection info
- model: model for which to create index
- column: column to add to the table
**Returns**
- *AddColumnStatement: statement used to prepare operation
func (*AddColumnStatement) Prepare ¶
func (statement *AddColumnStatement) Prepare() *PreparedStatement
Prepare prepares the statement for execution
**Returns**
- *PreparedStatement: operation used to execute statement
type AddUnique ¶
type AddUnique struct {
// contains filtered or unexported fields
}
AddUnique statement which adds a unique index to a table
func NewAddUnique ¶
func NewAddUnique(connection *sql.DB, connectioninfo connection.IConnectionInfo, model *models.EntityModel, unique *models.IndexDescriptor) *AddUnique
NewAddUnique creates a new AddUnique statement
**Parameters**
- connection: connection used to execute sql statement
- connectioninfo: driver specific connection info
- model: model for which to create index
- unique: unique index to add
**Returns**
- *AddUnique: statement used to prepare operation
func (*AddUnique) Prepare ¶
func (statement *AddUnique) Prepare() *PreparedStatement
Prepare prepares the statement for execution
**Returns**
- *PreparedStatement: operation used to execute statement
type CreateIndexStatement ¶
type CreateIndexStatement struct {
// contains filtered or unexported fields
}
CreateIndexStatement statement used to prepare an operation used to create an index
func NewCreateIndexStatement ¶
func NewCreateIndexStatement(model *models.EntityModel, index *models.IndexDescriptor, connection *sql.DB, connectioninfo connection.IConnectionInfo) *CreateIndexStatement
NewCreateIndexStatement creates a new CreateIndexStatement
**Parameters**
- model: model for which to create index
- index: index to create
- connection: connection used to execute sql statement
- connectioninfo: driver specific connection info
**Returns**
-*CreateIndexStatement: statement used to prepare operation
func (*CreateIndexStatement) Prepare ¶
func (statement *CreateIndexStatement) Prepare() *PreparedStatement
Prepare prepares the statement for execution
**Returns**
- *PreparedStatement: operation used to execute statement
type CreateStatement ¶
type CreateStatement struct {
// contains filtered or unexported fields
}
CreateStatement statement used to create tables for models in database
func NewCreateStatement ¶
func NewCreateStatement(model *models.EntityModel, connection *sql.DB, connectioninfo connection.IConnectionInfo) *CreateStatement
NewCreateStatement creates a new create statement
**Parameters**
- model: model representing entity for which to create a new table
- connection: connection to database
- connectioninfo: driver specific connection info
**Returns**
- CreateStatement: statement used to prepare create operation
func (*CreateStatement) Prepare ¶
func (statement *CreateStatement) Prepare() *PreparedStatement
Prepare prepares the statement for execution
**Returns**
- PreparedStatement: statement to use to create table
type DeleteStatement ¶
type DeleteStatement struct {
// contains filtered or unexported fields
}
DeleteStatement statement used to delete entity data from the database
func NewDeleteStatement ¶
func NewDeleteStatement(model *models.EntityModel, connection *sql.DB, connectioninfo connection.IConnectionInfo) *DeleteStatement
NewDeleteStatement creates a statement used to delete entities from a database
**Parameters**
- model: model of entity of which to delete rows
- connection: connection used to send sql statements
- connectioninfo: driver specific database information
**Returns**
- DeleteStatement: statement to use to prepare operation
func (*DeleteStatement) Prepare ¶
func (statement *DeleteStatement) Prepare() *PreparedStatement
Prepare prepares the statement for execution
**Returns**
- PreparedStatement: statement used to execute command
func (*DeleteStatement) Where ¶
func (statement *DeleteStatement) Where(predicate interface{}) *DeleteStatement
Where adds a predicate used to filter for data to delete
**Parameters**
- predicate: predicate expression specifying data to delete
**Returns**
- DeleteStatement: current statement for fluent behavior
type DropIndex ¶
type DropIndex struct {
// contains filtered or unexported fields
}
DropIndex statement which removes an index from the database
func NewDropIndex ¶
func NewDropIndex(connection *sql.DB, connectioninfo connection.IConnectionInfo, model *models.EntityModel, name string) *DropIndex
NewDropIndex creates a new DropIndex statement
**Parameters**
- connection: connection used to execute sql statement
- connectioninfo: driver specific connection info
- model: model for which to create index
- name: name of index to drop
**Returns**
- *DropIndex: statement used to prepare operation
func (*DropIndex) Prepare ¶
func (statement *DropIndex) Prepare() *PreparedStatement
Prepare prepares the statement for execution
**Returns**
- *PreparedStatement: operation used to execute statement
type DropTable ¶
type DropTable struct {
// contains filtered or unexported fields
}
DropTable statement to remove a table in a database
func NewDropTable ¶
func NewDropTable(connection *sql.DB, connectioninfo connection.IConnectionInfo, name string) *DropTable
NewDropTable creates a new DropTable statement
**Parameters**
- connection: connection to use to execute statement
- connectioninfo: driver specific connection info
- name: name of table to remove
**Returns**
- *DropTable: statement to use to prepare operation
func (*DropTable) Prepare ¶
func (statement *DropTable) Prepare() *PreparedStatement
Prepare prepares the statement for execution
**Returns**
- *PreparedStatement: prepared operation to execute
type ILoadEntityStatement ¶
type ILoadEntityStatement interface {
// adds a where predicate to a load statement
Where(predicate interface{}) ILoadEntityStatement
// prepares the statement for execution
Prepare() IPreparedLoadEntityStatement
}
ILoadEntityStatement - interface for statement used to load entities from database
type IPreparedLoadEntityStatement ¶
type IPreparedLoadEntityStatement interface {
// Command sql command string sent to database
//
// **Returns**
// - string: sql-command
Command() string
// loads the data from database
Execute(arguments ...interface{}) ([]interface{}, error)
}
IPreparedLoadEntityStatement - interface for a prepared statement used to load entities from a database
type InsertLoad ¶
type InsertLoad struct {
// contains filtered or unexported fields
}
InsertLoad - statement used to insert data into a database table
func NewInsertLoad ¶
func NewInsertLoad(model *models.EntityModel, connection *sql.DB, connectioninfo connection.IConnectionInfo) *InsertLoad
NewInsertLoad - creates a new statement used to insert data to a database table
func (*InsertLoad) Columns ¶
func (statement *InsertLoad) Columns(columns ...*models.ColumnDescriptor) *InsertLoad
Columns specifies fields to fill from existing column descriptors
**Parameters**
- columns: columns to fill
**Returns**
- InsertLoad: this statement for fluent behavior
func (*InsertLoad) Fields ¶
func (statement *InsertLoad) Fields(fieldnames ...string) *InsertLoad
Fields specify fields to fill
**Parameters**
- `fieldnames`: names of field to insert. Remember that you have to specify at least all fields which don't map to columns having an autoincrement or default value
**Returns**
- InsertLoad: this statement for fluent behavior
func (*InsertLoad) Load ¶
func (statement *InsertLoad) Load(load *LoadStatement) *InsertLoad
Load specifies the load statement used to insert data into the table
**Parameters**
- load: statement used to load data to insert
**Returns**
- *InsertLoad: this statement for fluent behavior
func (*InsertLoad) Prepare ¶
func (statement *InsertLoad) Prepare() *PreparedStatement
Prepare prepares the insert statement for execution
**Returns** - `PreparedStatement`: Statement to execute
type InsertStatement ¶
type InsertStatement struct {
// contains filtered or unexported fields
}
InsertStatement - statement used to insert data into a database table
func NewInsertStatement ¶
func NewInsertStatement(model *models.EntityModel, connection *sql.DB, connectioninfo connection.IConnectionInfo) *InsertStatement
NewInsertStatement - creates a new statement used to insert data to a database table
func (*InsertStatement) Columns ¶
func (statement *InsertStatement) Columns(fieldnames ...string) *InsertStatement
Columns specify columns to fill
**Parameters**
- `fieldnames`: names of field to insert. Remember that you have to specify at least all fields which don't map to columns having an autoincrement or default value
**Returns**
- `InsertStatement`: this statement for fluent behavior
func (*InsertStatement) Prepare ¶
func (statement *InsertStatement) Prepare() *PreparedStatement
Prepare prepares the insert statement for execution
**Returns** - `PreparedStatement`: Statement to execute
type LoadEntityStatement ¶
type LoadEntityStatement struct {
// contains filtered or unexported fields
}
LoadEntityStatement - builds a load entity statement used to load entities from database
func NewLoadEntityStatement ¶
func NewLoadEntityStatement(model *models.EntityModel, connection *sql.DB, connectioninfo connection.IConnectionInfo) *LoadEntityStatement
NewLoadEntityStatement - creates a new LoadEntityStatement
func (*LoadEntityStatement) Alias ¶ added in v0.1.3
func (statement *LoadEntityStatement) Alias(alias string) ILoadEntityStatement
Alias set an alias to use when loading from the table
mainly used to prevent conflicts with joined tables
func (*LoadEntityStatement) Join ¶ added in v0.1.3
func (statement *LoadEntityStatement) Join(jointype JoinType, table string, predicate interface{}, alias string)
Join adds a join operation to apply to the load statement
func (*LoadEntityStatement) Prepare ¶
func (statement *LoadEntityStatement) Prepare() IPreparedLoadEntityStatement
Prepare - prepares the statement for execution
func (*LoadEntityStatement) Where ¶
func (statement *LoadEntityStatement) Where(predicate interface{}) ILoadEntityStatement
Where - adds a where predicate to a load statement
type LoadStatement ¶
type LoadStatement struct {
// contains filtered or unexported fields
}
LoadStatement statement used to load data from the database
func NewLoadStatement ¶
func NewLoadStatement(table string, connection *sql.DB, connectioninfo connection.IConnectionInfo) *LoadStatement
NewLoadStatement creates a new statement used to load data from the database
**Parameters**
- model: model of entity of which to load data
- connection: connection used to send sql statements
- connectioninfo: driver specific database information
**Returns**
- LoadStatement: statement to use to prepare operation
func (*LoadStatement) Columns ¶
func (statement *LoadStatement) Columns(columns []*models.ColumnDescriptor) *LoadStatement
Columns specifies columns to load
**Parameters**
- columns: columns to load in result set
**Returns**
- LoadStatement: this statement for fluent behavior
func (*LoadStatement) Fields ¶
func (statement *LoadStatement) Fields(fields ...interface{}) *LoadStatement
Fields set fields to load from database
**Parameters**
- fields: field expressions for data to load
**Returns**
- LoadStatement: this statement for fluent behavior
func (*LoadStatement) Prepare ¶
func (statement *LoadStatement) Prepare() *PreparedLoadStatement
Prepare prepares the load statement for execution
**Returns**
- PreparedLoadStatement: statement to be used to load data
func (*LoadStatement) Where ¶
func (statement *LoadStatement) Where(predicate interface{}) *LoadStatement
Where set predicate for data to match
**Parameters**
- predicate: predicate expression specifying filter
**Returns**
- LoadStatement: this statement for fluent behavior
type PreparedLoadEntityStatement ¶
type PreparedLoadEntityStatement struct {
// contains filtered or unexported fields
}
PreparedLoadEntityStatement - statement containing a prepared command string to be executed
func (*PreparedLoadEntityStatement) Command ¶ added in v0.1.3
func (statement *PreparedLoadEntityStatement) Command() string
Command sql command string sent to database
**Returns**
- string: sql-command
func (*PreparedLoadEntityStatement) Execute ¶
func (statement *PreparedLoadEntityStatement) Execute(arguments ...interface{}) ([]interface{}, error)
Execute - loads matching entity data from database
type PreparedLoadStatement ¶
type PreparedLoadStatement struct {
// contains filtered or unexported fields
}
PreparedLoadStatement statement used to load data from the database
func (*PreparedLoadStatement) Execute ¶
func (statement *PreparedLoadStatement) Execute(arguments ...interface{}) (*sql.Rows, error)
Execute executes the statement and returns the result rows
**Parameters**
- arguments: arguments used to fill statement parameters
**Returns**
- Rows: result rows
- error: error if statement could not get executed
func (*PreparedLoadStatement) ExecuteScalar ¶
func (statement *PreparedLoadStatement) ExecuteScalar(arguments ...interface{}) (interface{}, error)
ExecuteScalar executes the statement and returns one value as result. This means the statement should return exactly one column.
Multiple rows are supported however.
**Parameters**
- arguments: arguments used to fill statement parameters
**Returns**
- interface{}: result scalar
- error: error if statement could not get executed
func (*PreparedLoadStatement) ExecuteSet ¶
func (statement *PreparedLoadStatement) ExecuteSet(arguments ...interface{}) ([]interface{}, error)
ExecuteSet executes the statement and returns a set of result values. This means the statement should return a set of rows with exactly one column
**Parameters**
- arguments: arguments used to fill statement parameters
**Returns**
- []interface{}: result set
- error: error if statement could not get executed
type PreparedStatement ¶
type PreparedStatement struct {
// contains filtered or unexported fields
}
PreparedStatement - statement containing a prepared command to be executed
func (*PreparedStatement) Command ¶
func (statement *PreparedStatement) Command() string
Command sql command string send to database
**Returns**
- string: sql-command
func (*PreparedStatement) Execute ¶
func (statement *PreparedStatement) Execute(arguments ...interface{}) (int64, error)
Execute executes the statement
**Parameters**
- arguments: parameter values for statement
**Returns**
- int64: number of affected rows
- error: error if any occured
func (*PreparedStatement) ExecuteTransaction ¶
func (statement *PreparedStatement) ExecuteTransaction(transaction *sql.Tx, arguments ...interface{}) (int64, error)
ExecuteTransaction executes the statement using a transaction
**Parameters**
- transaction: transaction used to execute statement
- arguments: parameter values for statement
**Returns**
- int64: number of affected rows
- error: error if any occured
type RenameTable ¶
type RenameTable struct {
// contains filtered or unexported fields
}
RenameTable statement used to rename a table in a database
func NewRenameTable ¶
func NewRenameTable(connection *sql.DB, connectioninfo connection.IConnectionInfo, oldname string, newname string) *RenameTable
NewRenameTable creates a new RenameTable statement
**Parameters**
- connection: connection to use to execute statement
- connectioninfo: driver specific connection info
- oldname: current name of table
- newname: name to rename table to
**Returns**
- *RenameTable: statement to use to prepare operation
func (*RenameTable) Prepare ¶
func (statement *RenameTable) Prepare() *PreparedStatement
Prepare prepares the statement for execution
**Returns**
- *PreparedStatement: prepared operation to execute
type UpdateStatement ¶
type UpdateStatement struct {
// contains filtered or unexported fields
}
UpdateStatement statement used to update data in a database
func NewUpdateStatement ¶
func NewUpdateStatement(model *models.EntityModel, connection *sql.DB, connectioninfo connection.IConnectionInfo) *UpdateStatement
NewUpdateStatement creates a statement used to update entities of a database
**Parameters**
- model: model of entity of which to update rows
- connection: connection used to send sql statements
- connectioninfo: driver specific database information
**Returns**
- UpdateStatement: statement to use to prepare operation
func (*UpdateStatement) Prepare ¶
func (statement *UpdateStatement) Prepare() *PreparedStatement
Prepare prepares the statement for execution
**Returns**
- PreparedStatement: statement used to execute command
func (*UpdateStatement) Set ¶
func (statement *UpdateStatement) Set(operations ...interface{}) *UpdateStatement
Set specifies update operations for statement
**Parameters**
- operations: expressions specifying update operations
**Returns**
- UpdateStatement: current statement for fluent behavior
func (*UpdateStatement) Where ¶
func (statement *UpdateStatement) Where(predicate interface{}) *UpdateStatement
Where adds a predicate used to filter for data to update
**Parameters**
- predicate: predicate expression specifying filter for data to update
**Returns**
- UpdateStatement: current statement for fluent behavior