mongodb

package
v0.0.0-...-be82979 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcMongoUri

func CalcMongoUri(params UriParams) string

func TransformId

func TransformId(id string) (primitive.ObjectID, error)

func TransformIds

func TransformIds(ids []string) ([]primitive.ObjectID, error)

Types

type Collection

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

type DB

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

func New

func New(uri string, dbName string) (*DB, error)

func (*DB) GetCollection

func (m *DB) GetCollection(n string) *mongo.Collection

type UriParams

type UriParams struct {
	Host  string
	Port  string
	User  string
	Pass  string
	Db    string
	Query string
}

Jump to

Keyboard shortcuts

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