db

package
v0.0.0-...-789275d Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2017 License: MIT Imports: 0 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 {
	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 Namer

type Namer interface {
	New(string) string
}

Namer exposes a method which can be used to generate specific names based on a giving critieras.

type TableConsumer

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

TableConsumer defines an interface which accepts a map of data which will be loaded into the giving implementing structure.

type TableFields

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

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.

type TableNamer

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

TableNamer defines holds a underline naming mechanism to deliver new TableName instance.

func NewTableNamer

func NewTableNamer(nm Namer) *TableNamer

NewTableNamer returns a new TableNamer instance.

func (*TableNamer) New

func (t *TableNamer) New(table string) TableName

New returns a new TableName which is fed into the underline naming mechanism to generate a unique name for that table. eg namer = FeedNamer("sugo_company"); TableNamer(namer).New("users") => "sugo_company_users".

Directories

Path Synopsis
sql

Jump to

Keyboard shortcuts

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