Documentation
¶
Index ¶
- Variables
- type AggFunc
- type AlterTableStmt
- type Backend
- type CreateTableStmt
- type DeleteStmt
- type DropTableStmt
- type Engine
- func (e *Engine) Close() error
- func (e *Engine) Execute(sql string) (ExecResult, error)
- func (e *Engine) ExecuteStatement(stmt Statement) (ExecResult, error)
- func (e *Engine) Parse(sql string) (Statement, error)
- func (e *Engine) WithActor(user *driver.AuthenticatedUser) *Engine
- func (e *Engine) WithDBAttrs(attrs ...kernal.SchemaAttributer) *Engine
- func (e *Engine) WithSharedCacheFrom(other *Engine) *Engine
- type ExecResult
- type InsertStmt
- type JoinClause
- type JoinType
- type Pagination
- type SelectField
- type SelectStmt
- type Statement
- type StatementType
- type SubqueryCondition
- type TruncateTableStmt
- type UpdateStmt
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrSystemTableAccessDenied = fmt.Errorf("system table access denied: super_admin role required")
Functions ¶
This section is empty.
Types ¶
type AlterTableStmt ¶
type AlterTableStmt struct {
Table string
Plan kernal.AlterTablePlan
}
func (AlterTableStmt) TableName ¶
func (s AlterTableStmt) TableName() string
func (AlterTableStmt) Type ¶
func (s AlterTableStmt) Type() StatementType
type CreateTableStmt ¶
type CreateTableStmt struct {
Table string
Schema kernal.TableSchema
}
func (CreateTableStmt) TableName ¶
func (s CreateTableStmt) TableName() string
func (CreateTableStmt) Type ¶
func (s CreateTableStmt) Type() StatementType
type DeleteStmt ¶
type DeleteStmt struct {
Table string
Conditions []kernal.QueryCondition
}
func (DeleteStmt) TableName ¶
func (s DeleteStmt) TableName() string
func (DeleteStmt) Type ¶
func (s DeleteStmt) Type() StatementType
type DropTableStmt ¶
type DropTableStmt struct{ Table string }
func (DropTableStmt) TableName ¶
func (s DropTableStmt) TableName() string
func (DropTableStmt) Type ¶
func (s DropTableStmt) Type() StatementType
type Engine ¶
type Engine struct {
Database string
Backend Backend
Actor *driver.AuthenticatedUser
// contains filtered or unexported fields
}
func (*Engine) ExecuteStatement ¶
func (e *Engine) ExecuteStatement(stmt Statement) (ExecResult, error)
func (*Engine) WithDBAttrs ¶
func (e *Engine) WithDBAttrs(attrs ...kernal.SchemaAttributer) *Engine
func (*Engine) WithSharedCacheFrom ¶
type ExecResult ¶
type ExecResult struct {
Rows []kernal.Row `json:"rows,omitempty"`
Affected int `json:"affected"`
Inserted kernal.Row `json:"inserted,omitempty"`
InsertedRows []kernal.Row `json:"insertedRows,omitempty"`
Updated kernal.Row `json:"updated,omitempty"`
UpdatedRows []kernal.Row `json:"updatedRows,omitempty"`
Statement StatementType `json:"statement"`
Pagination *Pagination `json:"pagination,omitempty"`
}
type InsertStmt ¶
func (InsertStmt) TableName ¶
func (s InsertStmt) TableName() string
func (InsertStmt) Type ¶
func (s InsertStmt) Type() StatementType
type JoinClause ¶
type Pagination ¶ added in v1.68.6
type SelectField ¶
type SelectStmt ¶
type SelectStmt struct {
Table string
Fields []SelectField
Joins []JoinClause
Conditions []kernal.QueryCondition
SubConds []SubqueryCondition
GroupBy []string
OrderBy string
OrderDesc bool
Limit int
Offset int
Page int
PageSize int
}
func (SelectStmt) TableName ¶
func (s SelectStmt) TableName() string
func (SelectStmt) Type ¶
func (s SelectStmt) Type() StatementType
type Statement ¶
type Statement interface {
Type() StatementType
TableName() string
}
type StatementType ¶
type StatementType string
const ( StmtCreateTable StatementType = "create_table" StmtAlterTable StatementType = "alter_table" StmtInsert StatementType = "insert" StmtUpdate StatementType = "update" StmtDelete StatementType = "delete" StmtSelect StatementType = "select" StmtDropTable StatementType = "drop_table" StmtTruncate StatementType = "truncate_table" )
type SubqueryCondition ¶
type SubqueryCondition struct {
Field string
NotIn bool
SubStmt SelectStmt
}
SubqueryCondition 表示 IN/NOT IN 子查询条件,由 engine 展开为具体值列表后传入 kernal
type TruncateTableStmt ¶
type TruncateTableStmt struct{ Table string }
func (TruncateTableStmt) TableName ¶
func (s TruncateTableStmt) TableName() string
func (TruncateTableStmt) Type ¶
func (s TruncateTableStmt) Type() StatementType
type UpdateStmt ¶
func (UpdateStmt) TableName ¶
func (s UpdateStmt) TableName() string
func (UpdateStmt) Type ¶
func (s UpdateStmt) Type() StatementType
Click to show internal directories.
Click to hide internal directories.