set

package
v0.1.1-0...-1a83ed4 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBSet

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

DBSet lets you add, get and delete entities of a given model

func New

func New(tableName string, T reflect.Type, db *database.DBConnection) *DBSet

New creates a new DBSet

func (*DBSet) Add

func (set *DBSet) Add(entity interface{}) error

Add will add a new entity to the database

func (*DBSet) CreateTable

func (set *DBSet) CreateTable() error

CreateTable generates a database table from a given model

func (*DBSet) Delete

func (set *DBSet) Delete(entity interface{}) error

Delete will delete the given entity from the database

func (*DBSet) Get

func (set *DBSet) Get(valueMap map[string]interface{}, entity interface{}) error

Get will fetch an entity from the database according to the valueMap. valueMap should contain the struct field as a string for the key and the value being queried; this is done as AND statements

func (*DBSet) GetAsc

func (set *DBSet) GetAsc(valueMap map[string]interface{}, orderBy string, entity interface{}) error

GetAsc gets the first entity in ascending order

func (*DBSet) GetDesc

func (set *DBSet) GetDesc(valueMap map[string]interface{}, orderBy string, entity interface{}) error

GetDesc gets the first entity in descending order

func (*DBSet) TableName

func (set *DBSet) TableName() string

TableName returns the table name of this set

func (*DBSet) Type

func (set *DBSet) Type() reflect.Type

Type returns the type of this set

func (*DBSet) Update

func (set *DBSet) Update(entity interface{}) error

Update will update a given entity

Jump to

Keyboard shortcuts

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