Documentation
¶
Index ¶
- Variables
- func Create(db *mdb.Database, r *mdb.Record) error
- func Delete(db *mdb.Database, id string) error
- func Init(s selector.Selector) error
- func Read(db *mdb.Database, id string) (*mdb.Record, error)
- func Search(db *mdb.Database, md map[string]string, limit, offset int64) ([]*mdb.Record, error)
- func Update(db *mdb.Database, r *mdb.Record) error
- type DB
- type Driver
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultDB *db // Prefix for lookup in registry DBServiceNamespace = "go.micro.db" // Used to lookup the metadata for the driver DBDriverKey = "driver" // supported drivers: mysql, elastic, cassandra Drivers = map[string]Driver{} // Errors ErrNotFound = errors.New("not found") ErrAlreadyExists = errors.New("already exists") ErrNotAvailable = errors.New("not available") )
Functions ¶
Types ¶
type DB ¶
type DB interface {
// Initialise the database
// If the database doesn't exist
// will throw an error
Init(mdb *mdb.Database) error
// Close the connection
Close() error
// Query commands
Read(id string) (*mdb.Record, error)
Create(mdb *mdb.Record) error
Update(mdb *mdb.Record) error
Delete(id string) error
Search(md map[string]string, limit, offset int64) ([]*mdb.Record, error)
}
An initialised DB connection Must call Init to load Database/Table
Click to show internal directories.
Click to hide internal directories.