mongodb_odm

package module
v0.0.0-...-18a1620 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: MIT Imports: 10 Imported by: 0

README

mongodb_odm

Object document mapping for mongo. It is easier to work with object than bson, json or strings. Project is just simple odm, based on official mongo driver. Still in development.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	Connect(host, port, username, password, database string) error
	SetDatabase(database string)
	FindMany(filter interface{}, documents interface{}) error
	FindOne(filter interface{}, document interface{}) error
	FindByID(id interface{}, document interface{}) error
	FindObject(document interface{}) error
	InsertMany(documents interface{}) error
	InsertOne(document interface{}) error
	UpdateMany(collection interface{}, filter interface{}, update interface{}) (matchedCount int64, modifiedCount int64, upsertedID interface{}, err error)
	UpdateOne(collection interface{}, filter interface{}, update interface{}) (matchedCount int64, modifiedCount int64, upsertedID interface{}, err error)
	UpdateByID(id interface{}, document interface{}) error
	UpdateObject(document interface{}) error
	UpdateOrInsertByID(id interface{}, document interface{}) error
	UpdateOrInsertObject(document interface{}) error
	DeleteMany(collection interface{}, filter interface{}) (deletedCount int64, err error)
	DeleteOne(collection interface{}, filter interface{}) (deletedCount int64, err error)
	DeleteByID(collection interface{}, id interface{}) error
	DeleteObject(document interface{}) error
}

type MongoManager

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

func (*MongoManager) Connect

func (m *MongoManager) Connect(host, port, user, pass, dbName string) error

func (*MongoManager) DeleteByID

func (m *MongoManager) DeleteByID(collection interface{}, id interface{}) error

func (*MongoManager) DeleteMany

func (m *MongoManager) DeleteMany(collection interface{}, filter interface{}) (deletedCount int64, err error)

func (*MongoManager) DeleteObject

func (m *MongoManager) DeleteObject(document interface{}) error

func (*MongoManager) DeleteOne

func (m *MongoManager) DeleteOne(collection interface{}, filter interface{}) (deletedCount int64, err error)

func (*MongoManager) FindByID

func (m *MongoManager) FindByID(id interface{}, document interface{}) error

func (*MongoManager) FindMany

func (m *MongoManager) FindMany(filter interface{}, documents interface{}) error

func (*MongoManager) FindObject

func (m *MongoManager) FindObject(document interface{}) error

func (*MongoManager) FindOne

func (m *MongoManager) FindOne(filter interface{}, document interface{}) error

func (*MongoManager) InsertMany

func (m *MongoManager) InsertMany(documents interface{}) error

func (*MongoManager) InsertOne

func (m *MongoManager) InsertOne(document interface{}) error

func (*MongoManager) SetDatabase

func (m *MongoManager) SetDatabase(dbName string)

func (*MongoManager) UpdateByID

func (m *MongoManager) UpdateByID(id interface{}, document interface{}) error

func (*MongoManager) UpdateMany

func (m *MongoManager) UpdateMany(collection interface{}, filter interface{}, update interface{}) (matchedCount int64, modifiedCount int64, upsertedID interface{}, err error)

func (*MongoManager) UpdateObject

func (m *MongoManager) UpdateObject(document interface{}) error

func (*MongoManager) UpdateOne

func (m *MongoManager) UpdateOne(collection interface{}, filter interface{}, update interface{}) (matchedCount int64, modifiedCount int64, upsertedID interface{}, err error)

func (*MongoManager) UpdateOrInsertByID

func (m *MongoManager) UpdateOrInsertByID(id interface{}, document interface{}) error

todo make it in one request

func (*MongoManager) UpdateOrInsertObject

func (m *MongoManager) UpdateOrInsertObject(document interface{}) error

Jump to

Keyboard shortcuts

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