db

package
v0.0.0-...-b819305 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter struct {
	ID    string `bson:"_id,omitempty"`
	Total int    `bson:"total,omitempty"`
}

type MongoDB

type MongoDB struct {
	Collection *mongo.Collection
	Ctx        context.Context
}

func NewMongoDB

func NewMongoDB(server string, database string, collection string) *MongoDB

func (MongoDB) Count

func (m MongoDB) Count(key string) (map[string]int, error)

func (MongoDB) Get

func (m MongoDB) Get(elm interface{}, filter interface{}) error

filter := bson.D{{"voterid", id}}

func (MongoDB) QueryFilter

func (m MongoDB) QueryFilter(key string, value interface{}) interface{}

func (MongoDB) QueryUpdate

func (m MongoDB) QueryUpdate(key string, value interface{}) interface{}

func (MongoDB) Set

func (m MongoDB) Set(elm interface{}, filter interface{}, update interface{}) error

filter := db.FilterBson("voterid", message.VoterId) update := db.UpdateBson("vote", message.Vote)

Jump to

Keyboard shortcuts

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