storage

package
v0.0.0-...-72b410f Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IncidentsColl = "incidents"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoDB

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

func (*MongoDB) Delete

func (md *MongoDB) Delete(ctx context.Context, name string) error

func (*MongoDB) Get

func (md *MongoDB) Get(ctx context.Context, name string, doc interface{}) error

func (*MongoDB) GetAll

func (md *MongoDB) GetAll(ctx context.Context, docs interface{}) error

func (*MongoDB) Init

func (md *MongoDB) Init(ctx context.Context) (err error)

func (*MongoDB) Set

func (md *MongoDB) Set(ctx context.Context, data interface{}) error

func (*MongoDB) Update

func (md *MongoDB) Update(ctx context.Context, name string, data interface{}) error

type MongoDBOpts

type MongoDBOpts struct {
	URI                    string
	DatabaseName           string
	Username               string
	Password               string
	ReplicaSet             string
	ConnectTimeout         time.Duration
	ServerSelectionTimeout time.Duration
	SocketTimeout          time.Duration
}

type Storage

type Storage interface {
	Init(ctx context.Context) error
	Get(ctx context.Context, name string, item interface{}) error
	GetAll(ctx context.Context, items interface{}) error
	Set(ctx context.Context, data interface{}) error
	Delete(ctx context.Context, name string) error
	Update(ctx context.Context, name string, data interface{}) error
}

Storage a common interface for all database storage

func NewMongoDB

func NewMongoDB(opts *MongoDBOpts) (Storage, error)

Jump to

Keyboard shortcuts

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