repository

package
v0.0.0-...-82f818e Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateIndexes

func CreateIndexes(ctx context.Context, col *mongo.Collection, indexes []mongo.IndexModel, dropIndexes bool) error

func MongoDatabase

func MongoDatabase(mongo_uri string, database string) *mongo.Database

func NoBootstrap

func NoBootstrap(db *mongo.Database) error

Types

type BallotRepositoryConf

type BallotRepositoryConf struct {
}

type Client

type Client interface {
	Col(collection string) Collection
}

func New

func New(repository_conf RepositoryConf, database_bootstrap func(*mongo.Database) error) Client

type Collection

type Collection interface {
	UpdateOne(filter interface{}, update map[string]interface{}) error
	FindOne(filter interface{}, dest interface{}) error
	Find(filter interface{}, dest interface{}) error
	FindByID(id primitive.ObjectID, dest interface{}) error
	InsertOne(data interface{}) (primitive.ObjectID, error)
	InsertMany(data []interface{}) error
	Drop() error
}

func NewWithCollection

func NewWithCollection(name string, col *mongo.Collection) Collection

type MongoCollection

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

func (*MongoCollection) Drop

func (col *MongoCollection) Drop() error

func (*MongoCollection) Find

func (col *MongoCollection) Find(filter interface{}, dest interface{}) error

func (*MongoCollection) FindByID

func (col *MongoCollection) FindByID(id primitive.ObjectID, dest interface{}) error

func (*MongoCollection) FindOne

func (col *MongoCollection) FindOne(filter interface{}, dest interface{}) error

func (*MongoCollection) InsertMany

func (col *MongoCollection) InsertMany(data []interface{}) error

func (*MongoCollection) InsertOne

func (col *MongoCollection) InsertOne(data interface{}) (primitive.ObjectID, error)

func (*MongoCollection) UpdateOne

func (col *MongoCollection) UpdateOne(filter interface{}, update map[string]interface{}) error

type RepositoryClient

type RepositoryClient struct {
	Conf RepositoryConf
	Db   *mongo.Database
}

func (*RepositoryClient) Col

func (c *RepositoryClient) Col(collection string) Collection

type RepositoryConf

type RepositoryConf struct {
	DatabaseURI  string
	DatabaseName string
}

Jump to

Keyboard shortcuts

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