api

package
v0.0.0-...-6f463b7 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

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

func (*Collection) DeleteOne

func (c *Collection) DeleteOne(filter interface{}) (*mongo.DeleteResult, error)

func (*Collection) Find

func (c *Collection) Find(filter interface{}, opts ...*options.FindOptions) (CursorAPI, error)

func (*Collection) FindOne

func (c *Collection) FindOne(filter interface{}, opts ...*options.FindOneOptions) SingleResultAPI

func (*Collection) GetCollection

func (c *Collection) GetCollection() *mongo.Collection

func (*Collection) InsertMany

func (c *Collection) InsertMany(documents []interface{}) (*mongo.InsertManyResult, error)

func (*Collection) InsertOne

func (c *Collection) InsertOne(document interface{}) (*mongo.InsertOneResult, error)

func (*Collection) ReplaceOne

func (c *Collection) ReplaceOne(filter interface{}, document interface{}) (*mongo.UpdateResult, error)

func (*Collection) UpdateOne

func (c *Collection) UpdateOne(filter interface{}, document interface{}) (*mongo.UpdateResult, error)

type CollectionAPI

type CollectionAPI interface {
	InsertOne(document interface{}) (*mongo.InsertOneResult, error)
	InsertMany(documents []interface{}) (*mongo.InsertManyResult, error)
	UpdateOne(filter interface{}, document interface{}) (*mongo.UpdateResult, error)
	ReplaceOne(filter interface{}, document interface{}) (*mongo.UpdateResult, error)
	FindOne(filter interface{}, opts ...*options.FindOneOptions) SingleResultAPI
	Find(filter interface{}, opts ...*options.FindOptions) (CursorAPI, error)
	DeleteOne(filter interface{}) (*mongo.DeleteResult, error)
}

func NewCollection

func NewCollection(collection *mongo.Collection) CollectionAPI

type CursorAPI

type CursorAPI interface {
	All(ctx context.Context, results interface{}) error
	Next(ctx context.Context) bool
	Decode(results interface{}) error
	Close(ctx context.Context) error
}

type Database

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

func (*Database) Collection

func (d *Database) Collection(s string) CollectionAPI

func (*Database) GetDB

func (d *Database) GetDB() *mongo.Database

type DatabaseAPI

type DatabaseAPI interface {
	Collection(string) CollectionAPI
}

func NewDatabase

func NewDatabase(db *mongo.Database) DatabaseAPI

type SingleResultAPI

type SingleResultAPI interface {
	Decode(interface{}) error
	DecodeBytes() (bson.Raw, error)
	Err() error
}

Jump to

Keyboard shortcuts

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