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 ¶
Namer exposes a method which can be used to generate specific names based on a giving critieras.
type TableConsumer ¶
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.
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".