mongodb

package
v5.0.0-...-0681bf2 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BleveQueryToMongoFilters

func BleveQueryToMongoFilters(queryString string, insensitive bool, fieldTransformer func(string) string) (filters []bson.E, err error)

BleveQueryToMongoFilters parses a Blevesearch query string to a slice of bson primitives

func OpenPool

func OpenPool(ctx context.Context, uu string) (storage.Storage, error)

Types

type CollStats

type CollStats struct {
	Count       int64
	AvgObjSize  int64
	StorageSize int64
}

type Collation

type Collation struct {
	Locale   string
	Strength int
}

type Collection

type Collection struct {
	Name               string
	DefaultCollation   Collation
	Indexes            []map[string]int
	IDName             string
	TruncateSorterDesc string
}

type Database

type Database struct {
	*mongo.Database
	// contains filtered or unexported fields
}

Database type wraps the *mongo.Database to prepend prefix to collection names

func (*Database) CloseAndDrop

func (d *Database) CloseAndDrop(ctx context.Context) error

CloseAndDrop implements storage.Dropper interface

func (*Database) Collection

func (d *Database) Collection(name string, opts ...*options.CollectionOptions) *mongo.Collection

Collection overrides collection name by appending prefix

func (*Database) CreateCollection

func (d *Database) CreateCollection(ctx context.Context, name string, opts ...*options.CreateCollectionOptions) error

CreateCollection overrides name by appending prefix

type Indexer

type Indexer struct {
	*Database
	// contains filtered or unexported fields
}

func (*Indexer) Close

func (i *Indexer) Close(ctx context.Context) error

Close implements storage.Closer interface

func (*Indexer) CloseAndDrop

func (i *Indexer) CloseAndDrop(ctx context.Context) error

CloseAndDrop implements storage.Dropper interface

func (*Indexer) Count

func (i *Indexer) Count(ctx context.Context, query interface{}) (int, error)

func (*Indexer) DeleteMany

func (i *Indexer) DeleteMany(ctx context.Context, query interface{}) (int32, error)

func (*Indexer) DeleteOne

func (i *Indexer) DeleteOne(ctx context.Context, data interface{}) error

func (*Indexer) FindMany

func (i *Indexer) FindMany(ctx context.Context, query interface{}, offset, limit int32, sortFields string, sortDesc bool, customCodec indexer.IndexCodex) (chan interface{}, error)

func (*Indexer) GetCodex

func (i *Indexer) GetCodex() indexer.IndexCodex

func (*Indexer) Init

func (i *Indexer) Init(ctx context.Context, cfg configx.Values) error

func (*Indexer) InsertOne

func (i *Indexer) InsertOne(ctx context.Context, data interface{}) error

func (*Indexer) NewBatch

func (i *Indexer) NewBatch(ctx context.Context, opts ...indexer.BatchOption) (indexer.Batch, error)

func (*Indexer) Resync

func (i *Indexer) Resync(ctx context.Context, logger func(string)) error

func (*Indexer) Search

func (i *Indexer) Search(ctx context.Context, query interface{}, out any) error

func (*Indexer) SetCodex

func (i *Indexer) SetCodex(c indexer.IndexCodex)

func (*Indexer) SetCollection

func (i *Indexer) SetCollection(c string)

func (*Indexer) Stats

func (i *Indexer) Stats(ctx context.Context) map[string]interface{}

Stats method - TODO

func (*Indexer) Truncate

func (i *Indexer) Truncate(ctx context.Context, max int64, logger func(string)) error

Truncate removes records from collection. If max is set, we find the starting index for deletion based on the collection average object size (using collStats command)

type Model

type Model struct {
	Collections []Collection
}

func (Model) Init

func (m Model) Init(ctx context.Context, db *Database) error

Jump to

Keyboard shortcuts

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