Documentation ¶
Index ¶
- Constants
- type BaseOption
- type BaseOptionFunc
- func WithBatchSize(v int64) BaseOptionFunc
- func WithConds(vs ...any) BaseOptionFunc
- func WithDataBase(v string) BaseOptionFunc
- func WithDbShardingKey(v ...any) BaseOptionFunc
- func WithIDGenerate(v func(context.Context) any) BaseOptionFunc
- func WithIgnore(v bool) BaseOptionFunc
- func WithIterativeFunc(v ...func(any)) BaseOptionFunc
- func WithLock(v bool) BaseOptionFunc
- func WithOmits(vs ...string) BaseOptionFunc
- func WithPage(v IPage) BaseOptionFunc
- func WithReadOnly(v bool) BaseOptionFunc
- func WithSearchAfter(v ISearchAfter) BaseOptionFunc
- func WithSelects(vs ...string) BaseOptionFunc
- func WithTableName(v string) BaseOptionFunc
- func WithTbShardingKey(v ...any) BaseOptionFunc
- type DbAction
- type EmptyPo
- type IBaseTask
- type IBizRequest
- type IDbSharding
- type IEntity
- type IEventMessage
- type IGenerateID
- type IMQProducerRepository
- type IMapping
- type IMessage
- type IPage
- type IPaginator
- type IPo
- type IRange
- type IRepository
- type ISearchAfter
- type ISortField
- type ITableSharding
- type ITask
- type IUnitOfWork
Constants ¶
View Source
const (
BATCH_SIZE = 1000 // default batch size
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseOption ¶
type BaseOption struct { Ignore bool `json:"ignore"` // ignore if exist Lock bool `json:"lock"` // lock row ReadOnly bool `json:"readOnly"` // read only Selects []string `json:"selects"` // select fields Omits []string `json:"omits"` // omit fields select omit Conds []any `json:"conds"` // conds where Page IPage `json:"page"` // page SearchAfter ISearchAfter `json:"searchAfter"` // search after BatchSize int64 `json:"batchSize"` // exec by batch TableName string `json:"tableName"` // table name DataBase string `json:"dataBase"` // db name DbShardingKey []any `json:"dbShardingKey"` // db sharding key TbShardingKey []any `json:"tbShardingKey"` // table sharding key IDGenerate func(ctx context.Context) any `json:"-"` // id generate func IterativeFuncs []func(any) `json:"-"` // iterative func }
BaseOption base repo exec
func NewBaseOption ¶ added in v0.0.7
func NewBaseOption(opts ...BaseOptionFunc) *BaseOption
NewBaseOption with func
func (BaseOption) GetDataBase ¶ added in v0.1.0
func (opt BaseOption) GetDataBase(t IEntity) string
GetDataBase
func (BaseOption) GetTableName ¶ added in v0.1.0
func (opt BaseOption) GetTableName(t IEntity) string
GetTableName
type BaseOptionFunc ¶ added in v0.0.7
type BaseOptionFunc func(o *BaseOption)
BaseOptionFunc base option func
func WithDbShardingKey ¶ added in v0.0.11
func WithDbShardingKey(v ...any) BaseOptionFunc
WithDbShardingKey
func WithIDGenerate ¶ added in v0.0.10
func WithIDGenerate(v func(context.Context) any) BaseOptionFunc
WithIDGenerate
func WithIterativeFunc ¶ added in v0.1.0
func WithIterativeFunc(v ...func(any)) BaseOptionFunc
WithIterativeFunc
func WithSearchAfter ¶ added in v0.1.0
func WithSearchAfter(v ISearchAfter) BaseOptionFunc
WithSearchAfter
func WithTbShardingKey ¶ added in v0.0.11
func WithTbShardingKey(v ...any) BaseOptionFunc
WithTbShardingKey
type IBizRequest ¶
IBizRequest business tag reqquest
type IDbSharding ¶ added in v0.0.9
IDbSharding split database by keys
type IEventMessage ¶ added in v0.3.4
type IGenerateID ¶ added in v0.0.10
type IGenerateID interface {
SetID(id any)
}
IGenerateID customer id generate
type IMQProducerRepository ¶ added in v0.3.4
type IMQProducerRepository[T IEventMessage] interface { IRepository[T] InsertAction(ctx context.Context, db string, t *T) func(context.Context) error WaitExecWithLock(ctx context.Context, t T, batch int) (string, int64, error) FindLockeds(ctx context.Context, locker string) ([]T, error) }
IMQProducerRepository
type IMapping ¶ added in v0.1.0
type IMapping interface {
GetMapping() string
}
Create a new index.
mapping := `{ "settings":{ "number_of_shards":1, "number_of_replicas":0 }, "mappings":{ "properties":{ "tags":{ "type":"keyword" }, "location":{ "type":"geo_point" }, "suggest_field":{ "type":"completion" } } } }`
type IPage ¶
type IPage interface { GetPageIndex() int64 GetPageSize() int64 GetBegin() int64 GetSize() int64 GetSorts() []ISortField }
IPage page request
type IPaginator ¶
type IPo ¶
type IPo interface { ID() any TableName() string Database() string ToRow() []string ToJson() string }
IPo for db po struct
type IRepository ¶
type IRepository[T IEntity] interface { BaseCreate(ctx context.Context, ps []*T, opts ...BaseOptionFunc) (int64, error) BaseSave(ctx context.Context, ps []*T, opts ...BaseOptionFunc) (int64, error) BaseUpdate(ctx context.Context, p *T, opts ...BaseOptionFunc) (int64, error) BaseGet(ctx context.Context, opts ...BaseOptionFunc) (*T, error) BaseDelete(ctx context.Context, p *T, opts ...BaseOptionFunc) (int64, error) BaseCount(ctx context.Context, opts ...BaseOptionFunc) (int64, error) BaseQuery(ctx context.Context, opts ...BaseOptionFunc) ([]T, error) BaseQueryWithCount(ctx context.Context, opts ...BaseOptionFunc) ([]T, int64, error) }
IRepository repo
type ISearchAfter ¶ added in v0.1.0
type ISearchAfter interface { GetSortValues() []any GetSorts() []ISortField }
type ISortField ¶
ISortField sort field
type ITableSharding ¶ added in v0.0.9
ITableSharding split table by keys
Click to show internal directories.
Click to hide internal directories.