datastore

package
v0.0.0-...-0fda301 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Conn *gorm.DB

Conn is the database connection used to store data

Functions

func CountEntities

func CountEntities(model interface{}, out interface{}, where interface{}, args ...interface{}) *herr.Error

CountEntities count entities from the datastore with the given constraints

func DeleteEntity

func DeleteEntity(in Identifiable) *herr.Error

DeleteEntity delete an entity in the datastore, using the ID property of the given model.

func FetchEntities

func FetchEntities(out interface{}, where ...interface{}) *herr.Error

FetchEntities fetch entities from the datastore with the given constraints

func FetchEntity

func FetchEntity(out interface{}, id int) *herr.Error

FetchEntity fetch an entity based on its ID

func FetchPagedEntities

func FetchPagedEntities(out interface{}, limit int, offset int, where ...interface{}) *herr.Error

FetchEntities fetch entities from the datastore with the given constraints

func Init

func Init(driver string, user string, password string, host string, port string, database string) error

Init initializes the database connection

func StoreEntity

func StoreEntity(in interface{}) *herr.Error

StoreEntity store a new entity in the datastore. The stored entity is not allowed to specify an ID.

func UpdateEntity

func UpdateEntity(in interface{}) *herr.Error

UpdateEntity update an entity in the datastore

Types

type Identifiable

type Identifiable interface {
	GetID() int
}

Identifiable represent an entity that can be identified by its unique ID All of the models used with this datastore must be identifiable.

Jump to

Keyboard shortcuts

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