data

package
v0.0.2-beta.3 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IData

type IData interface {
	Object(objectAPIName string) IObject
	NewTransaction() ITransaction
	Oql(oql string) IOql
}

type IDataV2

type IDataV2 interface {
	Object(objectAPIName string) IObjectV2
}

type IObject

type IObject interface {
	Create(ctx context.Context, record interface{}) (*structs.RecordID, error)
	BatchCreate(ctx context.Context, records interface{}) ([]int64, error)
	BatchCreateAsync(ctx context.Context, records interface{}) (int64, error)

	Update(ctx context.Context, recordID int64, record interface{}) error
	BatchUpdate(ctx context.Context, records map[int64]interface{}) error
	BatchUpdateAsync(ctx context.Context, records map[int64]interface{}) (int64, error)

	Delete(ctx context.Context, recordID int64) error
	BatchDelete(ctx context.Context, recordIDs []int64) error
	BatchDeleteAsync(ctx context.Context, recordIDs []int64) (int64, error)

	Count(ctx context.Context) (int64, error)
	Find(ctx context.Context, records interface{}) error
	FindOne(ctx context.Context, record interface{}) error
	FindAll(ctx context.Context, records interface{}) error

	// Where 配置过滤条件
	// @param condition:过滤条件,其类型为逻辑表达式 *cond.LogicalExpression 或算术表达式 *cond.ArithmeticExpression,不合法的类型会报错
	// @example condition:
	//     cond.And(...)
	//     cond.Or(...)
	//     cond.Eq(...)
	//     cond.Gt(...)
	// @return 返回查询对象
	Where(condition interface{}) IQuery
	Offset(offset int64) IQuery
	Limit(limit int64) IQuery
	OrderBy(fieldAPINames ...string) IQuery
	OrderByDesc(fieldAPINames ...string) IQuery
	Select(fieldAPINames ...string) IQuery
}

type IObjectV2

type IObjectV2 interface {
	Create(ctx context.Context, record interface{}) (*structs.RecordID, error)
	BatchCreate(ctx context.Context, records interface{}) ([]int64, error)

	Update(ctx context.Context, recordID int64, record interface{}) error
	BatchUpdate(ctx context.Context, records map[int64]interface{}) error

	Delete(ctx context.Context, recordID int64) error
	BatchDelete(ctx context.Context, recordIDs []int64) error

	Count(ctx context.Context) (int64, error)
	Find(ctx context.Context, records interface{}) error
	FindOne(ctx context.Context, record interface{}) error
	FindAll(ctx context.Context, records interface{}) error

	// Where 配置过滤条件
	// @param condition:过滤条件,其类型为逻辑表达式 *cond.LogicalExpression 或算术表达式 *cond.ArithmeticExpression,不合法的类型会报错
	// @example condition:
	//     cond.And(...)
	//     cond.Or(...)
	//     cond.Eq(...)
	//     cond.Gt(...)
	// @return 返回查询对象
	Where(condition interface{}) IQuery
	Offset(offset int64) IQuery
	Limit(limit int64) IQuery
	OrderBy(fieldAPINames ...string) IQuery
	OrderByDesc(fieldAPINames ...string) IQuery
	Select(fieldAPINames ...string) IQuery
}

type IOql

type IOql interface {
	Execute(ctx context.Context, resultSet interface{}) error
}

type IQuery

type IQuery interface {
	Count(ctx context.Context) (int64, error)
	Find(ctx context.Context, records interface{}) error
	FindOne(ctx context.Context, record interface{}) error
	FindAll(ctx context.Context, records interface{}) error

	// Where 配置过滤条件
	// @param condition:过滤条件,其类型为 *cond.LogicalExpression 或 *cond.ArithmeticExpression,不合法的类型会报错
	// @example condition:
	//     cond.And(...)
	//     cond.Or(...)
	//     cond.Eq(...)
	//     cond.Gt(...)
	// @return 返回查询对象
	Where(condition interface{}) IQuery
	Offset(offset int64) IQuery
	Limit(limit int64) IQuery
	OrderBy(fieldAPINames ...string) IQuery
	OrderByDesc(fieldAPINames ...string) IQuery
	Select(fieldAPINames ...string) IQuery
}

type ITransaction

type ITransaction interface {
	Object(objectAPIName string) ITransactionObject
	Commit(ctx context.Context) error
}

type ITransactionObject

type ITransactionObject interface {
	RegisterCreate(record interface{}) (*structs.TransactionRecordID, error)
	RegisterUpdate(recordID interface{}, record interface{})
	RegisterDelete(recordID interface{})
	RegisterBatchCreate(records interface{}) ([]interface{}, error)
	RegisterBatchUpdate(records interface{})
	RegisterBatchDelete(recordIDs interface{})
}

Directories

Path Synopsis
field_type

Jump to

Keyboard shortcuts

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