Documentation ¶
Index ¶
- Variables
- func CountEntities(model interface{}, out interface{}, where interface{}, args ...interface{}) *herr.Error
- func DeleteEntity(in Identifiable) *herr.Error
- func FetchEntities(out interface{}, where ...interface{}) *herr.Error
- func FetchEntity(out interface{}, id int) *herr.Error
- func FetchPagedEntities(out interface{}, limit int, offset int, where ...interface{}) *herr.Error
- func Init(driver string, user string, password string, host string, port string, ...) error
- func StoreEntity(in interface{}) *herr.Error
- func UpdateEntity(in interface{}) *herr.Error
- type Identifiable
Constants ¶
This section is empty.
Variables ¶
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 ¶
FetchEntities fetch entities from the datastore with the given constraints
func FetchEntity ¶
FetchEntity fetch an entity based on its ID
func FetchPagedEntities ¶
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 ¶
StoreEntity store a new entity in the datastore. The stored entity is not allowed to specify an ID.
func UpdateEntity ¶
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.