mongodb

package
v0.0.0-...-3a94e59 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

func Connect

func Connect(connString, database string) (Database, error)

Connect connects to mongodb

func (Database) Delete

func (db Database) Delete(table string, keys map[string]interface{}) error

Delete erases at most one element from database

func (Database) Get

func (db Database) Get(t string, keys map[string]interface{}, out interface{}) error

Get gets an item given a table and keys

func (Database) List

func (db Database) List(table string, keys map[string]interface{}, n int64, out interface{}) error

List retrieves all objects from a collection The n parameter is the limit of objects returned, use 0 for no limit And the out parameter must be a pointer to a slice

func (Database) Put

func (db Database) Put(obj interface{}, table string) error

Put inserts an item with the given input

func (Database) RawUpdate

func (db Database) RawUpdate(table string, keys, up map[string]interface{}) error

RawUpdate changes fields of one object matching the keys Here the update if any MongoDB update expression

func (Database) Replace

func (db Database) Replace(table string, keys map[string]interface{}, obj interface{}) error

Replace either inserts or updates an object

func (Database) Update

func (db Database) Update(table string, keys, obj map[string]interface{}) error

Update changes fields of one object

Jump to

Keyboard shortcuts

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