db

package
v0.1.57 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedType = errors.New("infra: unsupported type")
	ErrNotFound        = errors.New("document: not found")
	ErrDuplicateKey    = errors.New("infra: duplicate key")
	ErrInvalidData     = errors.New("infra: invalid data")
)

List of errors

Functions

This section is empty.

Types

type BulkWriteModel

type BulkWriteModel mongo.WriteModel

type Index

type Index struct {
	Name        string
	Keys        []IndexKey
	Unique      *bool
	Sparse      *bool
	ExpireAfter *time.Duration
}

Index holds database index

type IndexKey

type IndexKey struct {
	Key string
	Asc interface{}
}

type NoSql

type NoSql interface {
	Ping(ctx context.Context) error
	Disconnect(ctx context.Context) error
	EnsureIndices(ctx context.Context, tab string, index []Index) error
	DropIndices(ctx context.Context, tab string, index []Index) error
	Insert(ctx context.Context, tab string, v interface{}) error
	Update(ctx context.Context, col string, filter interface{}, data interface{}) error
	InsertMany(ctx context.Context, tab string, v []interface{}) error
	Count(ctx context.Context, col string, q interface{}) (int64, error)
	List(ctx context.Context, tab string, filter interface{}, skip, limit int64, v interface{}, sort ...interface{}) error
	FindOne(ctx context.Context, tab string, filter interface{}, v interface{}, sort ...interface{}) error
	PartialUpdateMany(ctx context.Context, col string, filter interface{}, data interface{}) error
	PartialUpdateManyByQuery(ctx context.Context, col string, filter interface{}, query UnorderedDbQuery) error
	BulkUpdate(ctx context.Context, col string, models []mongo.WriteModel) error
	Aggregate(ctx context.Context, col string, q []interface{}, v interface{}) error
	AggregateWithDiskUse(ctx context.Context, col string, q []interface{}, v interface{}) error
	Distinct(ctx context.Context, col, field string, q interface{}, v interface{}) error
	DeleteMany(ctx context.Context, col string, filter interface{}) error
}

NoSql interface wraps the database

type UnorderedDbQuery

type UnorderedDbQuery bson.M

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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