mongo

package
v0.0.0-...-fb29299 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Database(string) Database
	Connect(context.Context) error
	Disconnect(context.Context) error
	StartSession() (mongo.Session, error)
	UseSession(context.Context, func(mongo.SessionContext) error) error
	Ping(context.Context) error
}

func NewClient

func NewClient(connection string) (Client, error)

type Collection

type Collection interface {
	FindOne(context.Context, interface{}) SingleResult
	Find(context.Context, interface{}, ...*options.FindOptions) (Cursor, error)
	InsertOne(context.Context, interface{}) (interface{}, error)
	InsertMany(context.Context, []interface{}) ([]interface{}, error)
	UpdateOne(context.Context, interface{}, interface{}, ...*options.UpdateOptions) (*mongo.UpdateResult, error)
	UpdateMany(context.Context, interface{}, interface{}, ...*options.UpdateOptions) (*mongo.UpdateResult, error)
	DeleteOne(context.Context, interface{}) (int64, error)
	CountDocuments(context.Context, interface{}, ...*options.CountOptions) (int64, error)
	Aggregate(context.Context, interface{}) (Cursor, error)
}

type Cursor

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

type Database

type Database interface {
	Collection(string) Collection
	Client() Client
}

type SingleResult

type SingleResult interface {
	Decode(interface{}) error
}

Jump to

Keyboard shortcuts

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