Documentation ¶
Index ¶
- type AbstractAccessor
- func (dma *AbstractAccessor) GenericDeleteOne(id string, accessor Accessor) (DBObject, int, error)
- func (wfa *AbstractAccessor) GenericStoreOne(data DBObject, accessor Accessor) (DBObject, int, error)
- func (dma *AbstractAccessor) GenericUpdateOne(set DBObject, id string, accessor Accessor, new DBObject) (DBObject, int, error)
- func (dma *AbstractAccessor) GetCaller() *tools.HTTPCaller
- func (dma *AbstractAccessor) GetType() string
- func (dma *AbstractAccessor) Init(t tools.DataType, caller *tools.HTTPCaller)
- type AbstractObject
- func (dma *AbstractObject) Deserialize(j map[string]interface{}) DBObject
- func (r *AbstractObject) GenerateID()
- func (dma *AbstractObject) GetAccessor(caller *tools.HTTPCaller) Accessor
- func (ao *AbstractObject) GetID() string
- func (ao *AbstractObject) GetName() string
- func (dma *AbstractObject) Serialize() map[string]interface{}
- func (ao *AbstractObject) UpToDate()
- type Accessor
- type DBObject
- type ShallowDBObject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbstractAccessor ¶
type AbstractAccessor struct { Logger zerolog.Logger // Logger is the logger of the accessor, it's a specilized logger for the accessor Type string // Type is the data type of the accessor Caller *tools.HTTPCaller // Caller is the http caller of the accessor (optionnal) only need in a peer connection }
func (*AbstractAccessor) GenericDeleteOne ¶
GenericLoadOne loads one object from the database (generic)
func (*AbstractAccessor) GenericStoreOne ¶
func (wfa *AbstractAccessor) GenericStoreOne(data DBObject, accessor Accessor) (DBObject, int, error)
GenericLoadOne loads one object from the database (generic)
func (*AbstractAccessor) GenericUpdateOne ¶
func (dma *AbstractAccessor) GenericUpdateOne(set DBObject, id string, accessor Accessor, new DBObject) (DBObject, int, error)
GenericLoadOne loads one object from the database (generic) json expected in entry is a flatted object no need to respect the inheritance hierarchy
func (*AbstractAccessor) GetCaller ¶
func (dma *AbstractAccessor) GetCaller() *tools.HTTPCaller
func (*AbstractAccessor) GetType ¶
func (dma *AbstractAccessor) GetType() string
func (*AbstractAccessor) Init ¶
func (dma *AbstractAccessor) Init(t tools.DataType, caller *tools.HTTPCaller)
Init initializes the accessor with the data type and the http caller
type AbstractObject ¶
type AbstractObject struct { UUID string `json:"id,omitempty" bson:"id,omitempty" validate:"required"` Name string `json:"name,omitempty" bson:"name,omitempty" validate:"required"` UpdateDate time.Time `json:"update_date" bson:"update_date"` LastPeerWriter string `json:"last_peer_writer" bson:"last_peer_writer"` }
* AbstractObject is a struct that represents the basic fields of an object * it defines the object id and name * every data in base root model should inherit from this struct (only exception is the ResourceModel)
func (*AbstractObject) Deserialize ¶
func (dma *AbstractObject) Deserialize(j map[string]interface{}) DBObject
func (*AbstractObject) GenerateID ¶
func (r *AbstractObject) GenerateID()
func (*AbstractObject) GetAccessor ¶
func (dma *AbstractObject) GetAccessor(caller *tools.HTTPCaller) Accessor
GetAccessor returns the accessor of the object (abstract)
func (*AbstractObject) GetID ¶
func (ao *AbstractObject) GetID() string
GetID returns the id of the object (abstract)
func (*AbstractObject) GetName ¶
func (ao *AbstractObject) GetName() string
GetName returns the name of the object (abstract)
func (*AbstractObject) Serialize ¶
func (dma *AbstractObject) Serialize() map[string]interface{}
func (*AbstractObject) UpToDate ¶
func (ao *AbstractObject) UpToDate()
type Accessor ¶
type Accessor interface { Init(t tools.DataType, caller *tools.HTTPCaller) GetType() string GetCaller() *tools.HTTPCaller Search(filters *dbs.Filters, search string) ([]ShallowDBObject, int, error) LoadAll() ([]ShallowDBObject, int, error) LoadOne(id string) (DBObject, int, error) DeleteOne(id string) (DBObject, int, error) CopyOne(data DBObject) (DBObject, int, error) StoreOne(data DBObject) (DBObject, int, error) UpdateOne(set DBObject, id string) (DBObject, int, error) }
Accessor is an interface that defines the basic methods for an Accessor