mongodb

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package mongodb

Index

Constants

View Source
const (
	EnvMongoDBHost     = "MONGODB_HOST"
	EnvMongoDBPort     = "MONGODB_PORT"
	EnvMongoDB         = "MONGODB_DATABASE"
	EnvMongoDBUsername = "MONGODB_USERNAME"
	EnvMongoDBPassword = "MONGODB_PASSWORD"
)

Constants containing names of ENV variables

View Source
const (
	ConnectionString       = `mongodb://{{.Username}}:{{.Password}}@{{.Host}}:{{.Port}}`
	DefaultMongoDBDatabase = "sat-dev"
	DefaultMongoDBHost     = "mongo"
	DefaultMongoDBPort     = "27017"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.1.0

type Config struct {
	Host     string
	Port     string
	Username string
	Password string
}

func NewConfig added in v0.1.0

func NewConfig() (Config, error)

type ErrNotConfigured added in v0.1.0

type ErrNotConfigured struct {
	What string
}

func (ErrNotConfigured) Error added in v0.1.0

func (err ErrNotConfigured) Error() string

func (ErrNotConfigured) Is added in v0.1.0

func (err ErrNotConfigured) Is(target error) bool

type ErrNotSupported added in v0.1.0

type ErrNotSupported struct {
	Backend string
}

func (ErrNotSupported) Error added in v0.1.0

func (err ErrNotSupported) Error() string

type MongoClient

type MongoClient struct {
	Client *mongo.Client
	// contains filtered or unexported fields
}

MongoClient

func New

func New(ctx context.Context) (MongoClient, error)

New

func (MongoClient) Close

func (m MongoClient) Close(ctx context.Context) error

Close

func (MongoClient) CreateMission added in v0.1.0

func (m MongoClient) CreateMission(ctx context.Context, name string, description string, columns map[string]string) error

func (MongoClient) GetValues added in v0.1.3

func (m MongoClient) GetValues(ctx context.Context, id string) ([]map[string]interface{}, error)

func (MongoClient) ListMissions added in v0.1.0

func (m MongoClient) ListMissions(ctx context.Context) ([]map[string]string, error)

func (MongoClient) MissionInfo added in v0.1.0

func (m MongoClient) MissionInfo(context.Context, string) (map[string]interface{}, error)

func (MongoClient) Save

func (m MongoClient) Save(ctx context.Context, document map[string]interface{}) error

Save

func (MongoClient) UpdateMission added in v0.1.0

func (m MongoClient) UpdateMission(context.Context, string, string) error

Jump to

Keyboard shortcuts

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