gitlab.com/ignitionrobotics/web/ign-go@v1.0.0-rc4/repository.go (about)

     1  package ign
     2  
     3  // Repository represents a set of methods of a generic repository.
     4  // It is based in the Repository pattern, and allows to a system to change the underlying data structure
     5  // without changing anything else.
     6  // It could be used to provide an abstraction layer between a service and an ORM.
     7  type Repository interface {
     8  	Add(entity interface{}) (interface{}, *ErrMsg)
     9  	Get(id interface{}) (interface{}, *ErrMsg)
    10  	GetAll(offset, limit *int) ([]interface{}, *ErrMsg)
    11  	Update(id interface{}, entity interface{}) (interface{}, *ErrMsg)
    12  	Remove(id interface{}) (interface{}, *ErrMsg)
    13  	Find(criteria func(element interface{}) bool) ([]interface{}, *ErrMsg)
    14  	FindByIDs(ids []interface{}) ([]interface{}, *ErrMsg)
    15  	FindOne(criteria func(element interface{}) bool) (interface{}, *ErrMsg)
    16  	Clear() *ErrMsg
    17  	Count(criteria func(element interface{}) bool) int
    18  }