db

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect()

func Delete

func Delete(db *DB, collectionName string, id string) (*mongo.DeleteResult, error)

func Find

func Find[Type any](db *DB, collectionName string, filter interface{}, opts ...*options.FindOptions) ([]*Type, error)

func FindOne

func FindOne[Type any](db *DB, collectionName string, filter interface{}, opts ...*options.FindOneOptions) (*Type, error)

func Save

func Save[Type Saveable](db *DB, collectionName string, obj Type) (*mongo.UpdateResult, error)

Types

type Bsonable

type Bsonable interface {
	ToBson() *bson.M
}

type DB

type DB struct {
	// contains filtered or unexported fields
}

func Get

func Get() *DB

func (*DB) Collection

func (db *DB) Collection(collectionName string) *mongo.Collection

func (*DB) ProjectRoutes

func (db *DB) ProjectRoutes(projectId string) ([]*model.Route, error)

type Saveable

type Saveable interface {
	Bsonable
	GetID() *string
}

Jump to

Keyboard shortcuts

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