mongodb

package
v4.0.0-rc7 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const Driver = "mongodb"

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 NewDAO

func NewDAO(ctx context.Context, driver string, dsn string, prefix string) (dao.DAO, error)

NewDAO creates a new handler for the boltdb dao

func NewIndexer

func NewIndexer(ctx context.Context, dao dao.DAO) (dao.IndexDAO, error)

Types

type Collation

type Collation struct {
	Locale   string
	Strength int
}

type Collection

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

type DAO

type DAO interface {
	dao.DAO
	Collection(name string) *mongo.Collection
	DB() *mongo.Database
}

DAO defines the functions specific to the boltdb dao

type Handler

type Handler struct {
	dao.DAO
	// contains filtered or unexported fields
}

Handler for the main functions of the DAO

func (*Handler) Collection added in v4.0.1

func (h *Handler) Collection(name string) *mongo.Collection

Collection returns a usable *mongo.Collection

func (*Handler) DB

func (h *Handler) DB() *mongo.Database

DB returns the bolt DB object

func (*Handler) Init

func (h *Handler) Init(ctx context.Context, cfg configx.Values) error

Init initialises the handler

type IndexDAO

type IndexDAO interface {
	DAO
	dao.IndexDAO
	SetCollection(string)
}

type Indexer

type Indexer struct {
	DAO
	// contains filtered or unexported fields
}

func (*Indexer) Close

func (i *Indexer) Close(ctx context.Context) 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, customCodec dao.IndexCodex) (chan interface{}, error)

func (*Indexer) Flush

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

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) Resync

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

func (*Indexer) SetCodex

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

func (*Indexer) SetCollection

func (i *Indexer) SetCollection(c string)

func (*Indexer) Truncate

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

type Model

type Model struct {
	Collections []Collection
}

func (Model) Init

func (m Model) Init(ctx context.Context, dao DAO) error

Jump to

Keyboard shortcuts

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