db

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	Connect(string, string) DbHandle
	Create(string) EntityHandle
	GetEntity(string) EntityHandle
	Insert(EntityHandle, Row) error
	Remove(entity EntityHandle, id ObjectId) error
	Get(EntityHandle, func(fn func(interface{}) error) (interface{}, error), ObjectId) (Row, error)
	GetMatched(EntityHandle, func(fn func(interface{}) error) (interface{}, error), Match) ([]Row, error)
}
var DbInstance DB

type DbHandle

type DbHandle interface{}
var Dbh DbHandle

type EntityHandle

type EntityHandle interface{}

type Match

type Match map[string]interface{}

type MongoDb

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

func (*MongoDb) Connect

func (mdb *MongoDb) Connect(host string, dbName string) DbHandle

Connect establishes connection to the database server hosted in "host" and returns db handle for the given dbName

func (*MongoDb) Create

func (mdb *MongoDb) Create(entityName string) EntityHandle

func (*MongoDb) Get

func (mdb *MongoDb) Get(entity EntityHandle, fn func(func(interface{}) error) (interface{}, error), id ObjectId) (Row, error)

func (*MongoDb) GetEntity

func (mdb *MongoDb) GetEntity(entityName string) EntityHandle

func (*MongoDb) GetMatched

func (mdb *MongoDb) GetMatched(entity EntityHandle, fn func(func(interface{}) error) (interface{}, error), match Match) ([]Row, error)

func (*MongoDb) Insert

func (mdb *MongoDb) Insert(entity EntityHandle, rowEntry Row) error

func (*MongoDb) Remove

func (mdb *MongoDb) Remove(entity EntityHandle, id ObjectId) error

type ObjectId

type ObjectId interface{}

type Row

type Row interface{}

type Schema

type Schema interface{}

Jump to

Keyboard shortcuts

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