database

package
v0.0.0-...-91518e1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2020 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 Client

type Client interface {
	Collection(c string) Collection
}

Client represents a database connection.

type Collection

type Collection interface {
	FindOne(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) SingleResult
	InsertOne(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions) (interface{}, error)
}

Collection represents a MongoDB collection.

type Database

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

Database is the connection to the database.

func New

func New(ctx context.Context, uri, database string) (*Database, error)

New initializes a database connection using an URI.

func (Database) Collection

func (d Database) Collection(name string) Collection

Collection gets a handle for a collection with the given name.

type SingleResult

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

SingleResult represents a single result returned by an operation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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