entitydata

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorEntityNotFountBy = errors.New("Entity with given where condition not found")
	ErrorEntityNotDeleted = errors.New("Entity not deleted")
)

Functions

This section is empty.

Types

type EntityDatastore

type EntityDatastore interface {
	GetOneEntityBy(entity interface{}, key string, val interface{}) error
	GetEntityByID(entity interface{}, id uint) error
	GetAllEntities(entitySlice interface{}) error
	CreateEntity(entity interface{}) error
	SaveEntity(entity interface{}) error
	DeleteEntityByID(entity interface{}, id uint) error
}

EntityDatastore CRUD operations with abstract entity type using gorm.DB

type GormEntityDatastoreImpl

type GormEntityDatastoreImpl struct {
	*gorm.DB
}

GormEntityDatastoreImpl the EntityDatastore implementation using gorm.DB for database operations

func (*GormEntityDatastoreImpl) CreateEntity

func (ds *GormEntityDatastoreImpl) CreateEntity(entity interface{}) error

CreateEntity insert into entity table

func (*GormEntityDatastoreImpl) DeleteEntityByID

func (ds *GormEntityDatastoreImpl) DeleteEntityByID(entity interface{}, id uint) error

DeleteEntityByID delete entity by id (primary key) ID must be provided Attention ds is not the same as db!

func (*GormEntityDatastoreImpl) GetAllEntities

func (ds *GormEntityDatastoreImpl) GetAllEntities(entitySlice interface{}) error

GetAllEntities select * from table

func (*GormEntityDatastoreImpl) GetEntityByID

func (ds *GormEntityDatastoreImpl) GetEntityByID(entity interface{}, id uint) error

GetEntityByID ...

func (*GormEntityDatastoreImpl) GetOneEntityBy

func (ds *GormEntityDatastoreImpl) GetOneEntityBy(entity interface{}, key string, val interface{}) error

GetOneEntityBy select * from table where key = value

func (*GormEntityDatastoreImpl) LoadRelatedEntities

func (ds *GormEntityDatastoreImpl) LoadRelatedEntities(i interface{}) error

LoadRelatedEntities load embedded entities

func (*GormEntityDatastoreImpl) SaveEntity

func (ds *GormEntityDatastoreImpl) SaveEntity(entity interface{}) error

SaveEntity update entity table

Jump to

Keyboard shortcuts

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