mongostorage

package
v0.0.0-...-d5bd7fa Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoStorage

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

MongoStorage is a MongoDB implementation of a storage.

func New

func New(cfg config.MongoConfig) (*MongoStorage, error)

New creates a new MongoStorage

func (*MongoStorage) Connect

func (b *MongoStorage) Connect() error

Connect initializes the MongoStorage by using the appropriate Mongo functions. In addition it checks its collections and creates indices if necessary. This method must be called before the Mongo Backend can be used.

func (*MongoStorage) DeleteTask

func (b *MongoStorage) DeleteTask(taskID string) error

DeleteTask deletes a Task.

func (*MongoStorage) GetAllTasks

func (b *MongoStorage) GetAllTasks() ([]model.Task, error)

GetAllTasks returns all stored tasks.

func (*MongoStorage) GetAllTasksForUser

func (b *MongoStorage) GetAllTasksForUser(user string) ([]model.Task, error)

GetAllTasksForUser returns all stored tasks.

func (*MongoStorage) GetTask

func (b *MongoStorage) GetTask(taskID string) (model.Task, error)

GetTask gets one Task.

func (*MongoStorage) IsConnected

func (b *MongoStorage) IsConnected() bool

IsConnected indicates if there is a connection to a Mongo server

func (*MongoStorage) StoreTask

func (b *MongoStorage) StoreTask(task model.Task) (primitive.ObjectID, error)

StoreTask stores a task or updates a task when one with the same id exists.

func (*MongoStorage) UpdateTask

func (b *MongoStorage) UpdateTask(task model.Task) error

UpdateTask updates a Task.

Jump to

Keyboard shortcuts

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