Documentation ¶
Index ¶
- Variables
- type Filter
- type FilterBuilder
- func (f FilterBuilder) And(exprs ...FilterBuilder) FilterBuilder
- func (f FilterBuilder) Build() Filter
- func (f FilterBuilder) Eq(field string, val interface{}) FilterBuilder
- func (f FilterBuilder) Exists(field string) FilterBuilder
- func (f FilterBuilder) GreaterOrEq(field string, val interface{}) FilterBuilder
- func (f FilterBuilder) GreaterThan(field string, val interface{}) FilterBuilder
- func (f FilterBuilder) In(field string, val interface{}) FilterBuilder
- func (f FilterBuilder) Like(field string, val interface{}) FilterBuilder
- func (f FilterBuilder) LowerOrEq(field string, val interface{}) FilterBuilder
- func (f FilterBuilder) LowerThan(field string, val interface{}) FilterBuilder
- func (f FilterBuilder) NotEq(field string, val interface{}) FilterBuilder
- func (f FilterBuilder) NotIn(field string, val interface{}) FilterBuilder
- func (f FilterBuilder) Or(exprs ...FilterBuilder) FilterBuilder
- func (f FilterBuilder) ParseBytes(data []byte) error
- func (f FilterBuilder) ParseStuct(data interface{}) error
- type Find
- type Index
- type JoinOption
- type RDB
- type Table
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTransactionStated = errors.New("transaction already started") ErrTransactionNotFound = errors.New("not in transaction environment") ErrDocumentNotFound = errors.New("document not found") ErrNotImplemented = errors.New("not implemented") ErrDuplicated = errors.New("duplicated") )
Errors defind
Functions ¶
This section is empty.
Types ¶
type FilterBuilder ¶
type FilterBuilder map[string]interface{}
func NewFilterBuilder ¶
func NewFilterBuilder() FilterBuilder
func (FilterBuilder) And ¶
func (f FilterBuilder) And(exprs ...FilterBuilder) FilterBuilder
func (FilterBuilder) Build ¶
func (f FilterBuilder) Build() Filter
func (FilterBuilder) Eq ¶
func (f FilterBuilder) Eq(field string, val interface{}) FilterBuilder
func (FilterBuilder) Exists ¶
func (f FilterBuilder) Exists(field string) FilterBuilder
func (FilterBuilder) GreaterOrEq ¶
func (f FilterBuilder) GreaterOrEq(field string, val interface{}) FilterBuilder
func (FilterBuilder) GreaterThan ¶
func (f FilterBuilder) GreaterThan(field string, val interface{}) FilterBuilder
func (FilterBuilder) In ¶
func (f FilterBuilder) In(field string, val interface{}) FilterBuilder
func (FilterBuilder) Like ¶
func (f FilterBuilder) Like(field string, val interface{}) FilterBuilder
func (FilterBuilder) LowerOrEq ¶
func (f FilterBuilder) LowerOrEq(field string, val interface{}) FilterBuilder
func (FilterBuilder) LowerThan ¶
func (f FilterBuilder) LowerThan(field string, val interface{}) FilterBuilder
func (FilterBuilder) NotEq ¶
func (f FilterBuilder) NotEq(field string, val interface{}) FilterBuilder
func (FilterBuilder) NotIn ¶
func (f FilterBuilder) NotIn(field string, val interface{}) FilterBuilder
func (FilterBuilder) Or ¶
func (f FilterBuilder) Or(exprs ...FilterBuilder) FilterBuilder
func (FilterBuilder) ParseBytes ¶
func (f FilterBuilder) ParseBytes(data []byte) error
func (FilterBuilder) ParseStuct ¶
func (f FilterBuilder) ParseStuct(data interface{}) error
type Find ¶
type Find interface { // Fields 设置查询字段 Fields(fields ...string) Find // Sort 设置查询排序 Sort(sort string) Find // Start 设置限制查询上标 Start(start uint64) Find // Limit 设置查询数量 Limit(limit uint64) Find // All 查询多个 All(ctx context.Context, result interface{}) error // One 查询单个 One(ctx context.Context, result interface{}) error // Count 统计数量(非事务) Count(ctx context.Context) (uint64, error) }
Find find operation interface
type JoinOption ¶
type JoinOption struct { TxnID string // 事务ID,uuid RequestID string // 请求ID,可选项 Processor string // 处理进程号,结构为"IP:PORT-PID"用于识别事务session被存于那个TM多活实例 }
JoinOption defind join transaction options
type RDB ¶
type RDB interface { Clone() RDB // Table collection 操作 Table(collection string) Table // StartTransaction 开启新事务 StartTransaction(ctx context.Context) (RDB, error) // Commit 提交事务 Commit(context.Context) error // Abort 取消事务 Abort(context.Context) error // TxnInfo 当前事务信息,用于事务发起者往下传递 TxnInfo() *types.Transaction // NextSequence 获取新序列号(非事务) NextSequence(ctx context.Context, sequenceName string) (uint64, error) // Ping 健康检查 Ping() error // 健康检查 // HasTable 判断是否存在集合 HasTable(tablename string) (bool, error) // DropTable 移除集合 DropTable(tablename string) error // CreateTable 创建集合 CreateTable(tablename string) error IsDuplicatedError(error) bool IsNotFoundError(error) bool }
RDB db operation interface
type Table ¶
type Table interface { // Find 查询多个并反序列化到 Result Find(filter Filter) Find // Insert 插入数据, docs 可以为 单个数据 或者 多个数据 Insert(ctx context.Context, docs interface{}) error // Update 更新数据 Update(ctx context.Context, filter Filter, doc interface{}) error // Delete 删除数据 Delete(ctx context.Context, filter Filter) error // CreateIndex 创建索引 CreateIndex(ctx context.Context, index Index) error // DropIndex 移除索引 DropIndex(ctx context.Context, indexName string) error // Indexes 查询索引 Indexes(ctx context.Context) ([]Index, error) // AddColumn 添加字段 AddColumn(ctx context.Context, column string, value interface{}) error // RenameColumn 重命名字段 RenameColumn(ctx context.Context, oldName, newColumn string) error // DropColumn 移除字段 DropColumn(ctx context.Context, field string) error }
Table collection operation interface
Click to show internal directories.
Click to hide internal directories.