db

package
v0.0.0-...-e159260 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SortAscending  = 1
	SortDescending = -1
)

Variables

This section is empty.

Functions

func BuildSearchQueryFromString

func BuildSearchQueryFromString(d rules.Queryable, q string) bson.M

Types

type DB

type DB interface {
	Aggregate(d rules.Queryable, pipeline interface{}) ([]bson.M, error)
	Count(d rules.Queryable, filter FindFilter) (int, error)
	DeleteMany(d rules.Queryable, q bson.M) (*mongo.DeleteResult, error)
	Get(d rules.Queryable, q bson.M, o *options.FindOneOptions) error
	GetAll(d rules.Queryable, filter FindFilter) ([]rules.Queryable, error)
	Insert(d rules.Queryable) (*mongo.InsertOneResult, error)
	InsertMany(d rules.Queryable, i []interface{}) (*mongo.InsertManyResult, error)
	Ping() error
}

func NewMongoSession

func NewMongoSession() (DB, error)

type FindFilter

type FindFilter struct {
	Page    int
	PerPage int
	Sort    SortOption
	Query   primitive.M
}

type SortOption

type SortOption struct {
	Field string
	Order int
}

Jump to

Keyboard shortcuts

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