Documentation
¶
Index ¶
- func BindExpr(ctx *Context, tableName string, e expr.Expr) (err error)
- type AlterTableAddColumnStmt
- type AlterTableRenameStmt
- type Bindable
- type Context
- type CreateIndexStmt
- type CreateSequenceStmt
- type CreateTableStmt
- type DeleteStmt
- type DropIndexStmt
- type DropSequenceStmt
- type DropTableStmt
- type ExplainStmt
- type InsertStmt
- type PreparedStreamStmt
- type Preparer
- type ReIndexStmt
- type ReadOnly
- type Result
- type SelectCoreStmt
- type SelectStmt
- type Statement
- type StreamStmt
- type StreamStmtResult
- type Transactional
- type UpdateSetPair
- type UpdateStmt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AlterTableAddColumnStmt ¶
type AlterTableAddColumnStmt struct {
TableName string
ColumnConstraint *database.ColumnConstraint
TableConstraints database.TableConstraints
}
type AlterTableRenameStmt ¶
AlterTableRenameStmt is a DSL that allows creating a full ALTER TABLE query.
type Bindable ¶ added in v0.18.0
Optional interface that allows a statement to specify if they need to be bound to database objects.
type Context ¶
type Context struct {
DB *database.Database
Conn *database.Connection
Params []environment.Param
}
type CreateIndexStmt ¶
CreateIndexStmt represents a parsed CREATE INDEX statement.
type CreateSequenceStmt ¶
type CreateSequenceStmt struct {
IfNotExists bool
Info database.SequenceInfo
}
CreateSequenceStmt represents a parsed CREATE SEQUENCE statement.
type CreateTableStmt ¶
CreateTableStmt represents a parsed CREATE TABLE statement.
type DeleteStmt ¶
type DeleteStmt struct {
PreparedStreamStmt
TableName string
WhereExpr expr.Expr
OffsetExpr expr.Expr
OrderBy *expr.Column
LimitExpr expr.Expr
OrderByDirection scanner.Token
}
DeleteConfig holds DELETE configuration.
func (*DeleteStmt) Bind ¶ added in v0.17.0
func (stmt *DeleteStmt) Bind(ctx *Context) error
type DropIndexStmt ¶
DropIndexStmt is a DSL that allows creating a DROP INDEX query.
func (*DropIndexStmt) Bind ¶ added in v0.17.0
func (stmt *DropIndexStmt) Bind(ctx *Context) error
func (*DropIndexStmt) IsReadOnly ¶
func (stmt *DropIndexStmt) IsReadOnly() bool
IsReadOnly always returns false. It implements the Statement interface.
type DropSequenceStmt ¶
DropSequenceStmt is a DSL that allows creating a DROP INDEX query.
func (*DropSequenceStmt) Bind ¶ added in v0.17.0
func (stmt *DropSequenceStmt) Bind(ctx *Context) error
func (*DropSequenceStmt) IsReadOnly ¶
func (stmt *DropSequenceStmt) IsReadOnly() bool
IsReadOnly always returns false. It implements the Statement interface.
type DropTableStmt ¶
DropTableStmt is a DSL that allows creating a DROP TABLE query.
func (*DropTableStmt) Bind ¶ added in v0.17.0
func (stmt *DropTableStmt) Bind(ctx *Context) error
func (*DropTableStmt) IsReadOnly ¶
func (stmt *DropTableStmt) IsReadOnly() bool
IsReadOnly always returns false. It implements the Statement interface.
type ExplainStmt ¶
type ExplainStmt struct {
Statement Preparer
}
ExplainStmt is a Statement that displays information about how a statement is going to be executed, without executing it.
func (*ExplainStmt) Bind ¶ added in v0.17.0
func (stmt *ExplainStmt) Bind(ctx *Context) error
func (*ExplainStmt) IsReadOnly ¶
func (s *ExplainStmt) IsReadOnly() bool
IsReadOnly indicates that this statement doesn't write anything into the database.
func (*ExplainStmt) Run ¶
func (stmt *ExplainStmt) Run(ctx *Context) (*Result, error)
Run analyses the inner statement and displays its execution plan. If the statement is a stream, Optimize will be called prior to displaying all the operations. Explain currently only works on SELECT, UPDATE, INSERT and DELETE statements.
type InsertStmt ¶
type InsertStmt struct {
PreparedStreamStmt
TableName string
Values []expr.Expr
Columns []string
SelectStmt Preparer
Returning []expr.Expr
OnConflict database.OnConflictAction
}
InsertStmt holds INSERT configuration.
func (*InsertStmt) Bind ¶ added in v0.17.0
func (stmt *InsertStmt) Bind(ctx *Context) error
type PreparedStreamStmt ¶
PreparedStreamStmt is a PreparedStreamStmt using a Stream.
func (*PreparedStreamStmt) Run ¶
func (s *PreparedStreamStmt) Run(ctx *Context) (*Result, error)
Run returns a result containing the stream. The stream will be executed by calling the Iterate method of the result.
func (*PreparedStreamStmt) String ¶
func (s *PreparedStreamStmt) String() string
type ReIndexStmt ¶
type ReIndexStmt struct {
PreparedStreamStmt
TableOrIndexName string
}
ReIndexStmt is a DSL that allows creating a full REINDEX statement.
type ReadOnly ¶ added in v0.18.0
type ReadOnly interface {
IsReadOnly() bool
}
Optional interface that allows a statement to specify if it is read-only. Defaults to false if not implemented.
type Result ¶
type Result struct {
Result database.Result
Tx *database.Transaction
// contains filtered or unexported fields
}
Result of a query.
type SelectCoreStmt ¶
type SelectCoreStmt struct {
TableName string
Distinct bool
WhereExpr expr.Expr
GroupByExpr expr.Expr
ProjectionExprs []expr.Expr
}
func (*SelectCoreStmt) Bind ¶ added in v0.17.0
func (stmt *SelectCoreStmt) Bind(ctx *Context) error
func (*SelectCoreStmt) IsReadOnly ¶ added in v0.18.0
func (stmt *SelectCoreStmt) IsReadOnly() bool
type SelectStmt ¶
type SelectStmt struct {
PreparedStreamStmt
CompoundSelect []*SelectCoreStmt
CompoundOperators []scanner.Token
OrderBy *expr.Column
OrderByDirection scanner.Token
OffsetExpr expr.Expr
LimitExpr expr.Expr
}
SelectStmt holds SELECT configuration.
func (*SelectStmt) Bind ¶ added in v0.17.0
func (stmt *SelectStmt) Bind(ctx *Context) error
func (*SelectStmt) IsReadOnly ¶
func (stmt *SelectStmt) IsReadOnly() bool
type StreamStmt ¶
StreamStmt is a StreamStmt using a Stream.
type StreamStmtResult ¶ added in v0.17.0
StreamStmtResult iterates over a stream.
type Transactional ¶ added in v0.18.0
type Transactional interface {
NeedsTransaction() bool
}
Optional interface that allows a statement to specify if they need a transaction. Defaults to true if not implemented. If true, the engine will auto-commit.
type UpdateStmt ¶
type UpdateStmt struct {
PreparedStreamStmt
TableName string
// SetPairs is used along with the Set clause. It holds
// each column with its corresponding value that
// should be set in the row.
SetPairs []UpdateSetPair
WhereExpr expr.Expr
}
UpdateConfig holds UPDATE configuration.
func (*UpdateStmt) Bind ¶ added in v0.17.0
func (stmt *UpdateStmt) Bind(ctx *Context) error