mongodb

package
v0.0.0-...-ca49f88 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoDB

type MongoDB struct {
	Table string
	// contains filtered or unexported fields
}

MongoDB is a driver for simple operations over mongo replica

func New

func New(ctx context.Context, connstring, dbname, collection string) (*MongoDB, error)

New create monogdb using connstring. Connstring should be a replica one

func NewDefault

func NewDefault(ctx context.Context) (*MongoDB, error)

NewDefault creates mongodb from env variable MONGO_CONN

func (MongoDB) Delete

func (d MongoDB) Delete(ctx context.Context, s slt.Select) error

Delete removes object and makes sure it's version mathed

func (MongoDB) Get

func (d MongoDB) Get(ctx context.Context, id slt.SID) (s slt.Select, found bool, err error)

Get a record

func (MongoDB) QueryALL

func (d MongoDB) QueryALL(ctx context.Context, max int) ([]slt.Select, error)

QueryWaiting gets items based on receive and send channels

func (MongoDB) QueryWaiting

func (d MongoDB) QueryWaiting(ctx context.Context, user string, send []string, recv []string, max int) ([]slt.Select, error)

QueryWaiting gets items based on receive and send channels

func (MongoDB) Set

func (d MongoDB) Set(ctx context.Context, s slt.Select) (res slt.Select, conflict bool, err error)

Set simply updates a record, making sure that the versions match

Jump to

Keyboard shortcuts

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