Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DBProvider ¶ added in v0.1.5
DBProvider is a function type that returns the current database connection and an error
type InsertBatcher ¶
type InsertBatcher[T any] struct { // contains filtered or unexported fields }
InsertBatcher is a GORM batcher for batch inserts
func NewInsertBatcher ¶
func NewInsertBatcher[T any](dbProvider DBProvider, maxBatchSize int, maxWaitTime time.Duration, ctx context.Context) *InsertBatcher[T]
NewInsertBatcher creates a new InsertBatcher
func NewInsertBatcherWithOptions ¶ added in v0.1.27
func NewInsertBatcherWithOptions[T any](dbProvider DBProvider, ctx context.Context, opts ...batcher.Option) *InsertBatcher[T]
NewInsertBatcherWithOptions creates a new InsertBatcher with custom options
func (*InsertBatcher[T]) Insert ¶
func (b *InsertBatcher[T]) Insert(items ...T) error
Insert submits one or more items for batch insertion
func (*InsertBatcher[T]) InsertAsync ¶ added in v0.1.24
func (b *InsertBatcher[T]) InsertAsync(callback func(error), items ...T)
InsertAsync non-blocking version of Insert with a callback
type SelectBatcher ¶ added in v0.1.13
type SelectBatcher[T any] struct { // contains filtered or unexported fields }
func NewSelectBatcher ¶ added in v0.1.13
func NewSelectBatcher[T any](dbProvider DBProvider, maxBatchSize int, maxWaitTime time.Duration, ctx context.Context, columns []string) (*SelectBatcher[T], error)
NewSelectBatcher creates a new SelectBatcher
func NewSelectBatcherWithOptions ¶ added in v0.1.27
func NewSelectBatcherWithOptions[T any](dbProvider DBProvider, ctx context.Context, columns []string, opts ...batcher.Option) (*SelectBatcher[T], error)
NewSelectBatcherWithOptions creates a new SelectBatcher with custom options
func (*SelectBatcher[T]) Select ¶ added in v0.1.13
func (b *SelectBatcher[T]) Select(condition string, args ...interface{}) ([]T, error)
func (*SelectBatcher[T]) SelectAsync ¶ added in v0.1.24
func (b *SelectBatcher[T]) SelectAsync(callback func([]T, error), condition string, args ...interface{})
SelectAsync non-blocking version of Select with a callback
type SelectItem ¶ added in v0.1.13
type UpdateBatcher ¶
type UpdateBatcher[T any] struct { // contains filtered or unexported fields }
UpdateBatcher is a GORM batcher for batch updates
func NewUpdateBatcher ¶
func NewUpdateBatcher[T any](dbProvider DBProvider, maxBatchSize int, maxWaitTime time.Duration, ctx context.Context) (*UpdateBatcher[T], error)
Legacy constructor calls the new options-based one
func NewUpdateBatcherWithOptions ¶ added in v0.1.27
func NewUpdateBatcherWithOptions[T any](dbProvider DBProvider, ctx context.Context, opts ...batcher.Option) (*UpdateBatcher[T], error)
NewUpdateBatcherWithOptions primary constructor using options
func (*UpdateBatcher[T]) Update ¶
func (b *UpdateBatcher[T]) Update(items []T, updateFields []string) error
Update submits one or more items for batch update
func (*UpdateBatcher[T]) UpdateAsync ¶ added in v0.1.24
func (b *UpdateBatcher[T]) UpdateAsync(callback func(error), items []T, updateFields []string)
UpdateAsync non-blocking version of Update with a callback