mongodb

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, p *Params) (*mongo.Client, error)

Connect to the mongodb instance provided in p. See Params for more information.

Types

type Channel

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

Implements are_hub.ChannelRepo.

func NewChannelCollection

func NewChannelCollection(client *mongo.Client, db string) Channel

Create a channels collection in db.

func (Channel) All

func (c Channel) All(ctx context.Context) ([]are_hub.Channel, error)

func (Channel) Count

func (c Channel) Count(ctx context.Context) (int64, error)

Get a count of the number of documents in a collection.

func (Channel) DeleteID

func (c Channel) DeleteID(ctx context.Context, id string) (*are_hub.Channel, error)

func (Channel) FindID

func (c Channel) FindID(ctx context.Context, id string) (*are_hub.Channel, error)

func (Channel) Insert

func (c Channel) Insert(ctx context.Context, ptr are_hub.Archetype) error

Insert a document.

func (Channel) UpdateID

func (c Channel) UpdateID(ctx context.Context, hex string, ptr are_hub.Archetype) error

Update a document matching the hexadecimal-encoded ID.

type Params

type Params struct {
	// Name of the mongodb user to authenticate with.
	User string

	// Password of the said user.
	Password string

	// Authentication mechanism. Eg. "SCRAM-SHA-256", "MONGODB-X509".
	Mechanism string

	// Address (host + port). Eg. "localhost:27017".
	Address string

	// Name of the database.
	Name string
}

MongoDB connection parameters.

Jump to

Keyboard shortcuts

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