db

package
v0.0.0-...-df570b3 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: MIT Imports: 0 Imported by: 1

README

DB

Db contains different connection code for creating usable connection to different database. It allows me a central store to get a easy access to different underline store.

Supported

  • MongoDB

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	Save(t TableIdentity, f TableFields) error
	Count(t TableIdentity) (int, error)
	Update(t TableIdentity, f TableFields, index string) error
	Delete(t TableIdentity, index string, value interface{}) error
	Get(t TableIdentity, c TableConsumer, index string, value interface{}) error
	GetAll(t TableIdentity, order string, orderBy string) ([]map[string]interface{}, error)
	GetAllPerPage(t TableIdentity, order string, orderBy string, page int, responsePage int) ([]map[string]interface{}, int, error)
}

DB defines a type which allows CRUD operations provided by a underline db structure.

type Migration

type Migration interface {
	Migrate() error
}

Migration defines an interface which provides structures to setup a new db migration call.

type TableConsumer

type TableConsumer interface {
	Consume(map[string]interface{}) error
}

TableConsumer defines an interface that exposes a Consume method.

type TableFields

type TableFields interface {
	Fields() (map[string]interface{}, error)
}

TableFields defines an interface which exposes method to return a map of all data associated with the defined structure.

type TableIdentity

type TableIdentity interface {
	Table() string
}

TableIdentity defines an interface which exposes a method returning table name associated with the giving implementing structure.

type TableName

type TableName struct {
	Name string
}

TableName defines a struct which returns a given table name associated with the table.

func (TableName) Table

func (t TableName) Table() string

Table returns the giving name associated with the struct.

Directories

Path Synopsis
sql

Jump to

Keyboard shortcuts

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