test of a lightest formula of code

This commit is contained in:
mr
2024-11-28 11:05:54 +01:00
parent 15ca06aba8
commit 2816e3ea35
36 changed files with 574 additions and 783 deletions

View File

@@ -3,6 +3,7 @@ package utils
import (
"cloud.o-forge.io/core/oc-lib/dbs"
"cloud.o-forge.io/core/oc-lib/tools"
"github.com/rs/zerolog"
)
// ShallowDBObject is an interface that defines the basic methods shallowed version of a DBObject
@@ -10,8 +11,8 @@ type ShallowDBObject interface {
GenerateID()
GetID() string
GetName() string
Deserialize(j map[string]interface{}) DBObject
Serialize() map[string]interface{}
Deserialize(j map[string]interface{}, obj DBObject) DBObject
Serialize(obj DBObject) map[string]interface{}
}
// DBObject is an interface that defines the basic methods for a DBObject
@@ -20,15 +21,19 @@ type DBObject interface {
GetID() string
GetName() string
UpToDate()
Deserialize(j map[string]interface{}) DBObject
Serialize() map[string]interface{}
GetAccessor(caller *tools.HTTPCaller) Accessor
VerifyAuth(PeerID string, groups []string) bool
Deserialize(j map[string]interface{}, obj DBObject) DBObject
Serialize(obj DBObject) map[string]interface{}
GetAccessor(peerID string, groups []string, caller *tools.HTTPCaller) Accessor
}
// Accessor is an interface that defines the basic methods for an Accessor
type Accessor interface {
Init(t tools.DataType, caller *tools.HTTPCaller)
Init(t tools.DataType, peerID string, groups []string, caller *tools.HTTPCaller)
GetType() string
GetPeerID() string
GetGroups() []string
GetLogger() *zerolog.Logger
GetCaller() *tools.HTTPCaller
Search(filters *dbs.Filters, search string) ([]ShallowDBObject, int, error)
LoadAll() ([]ShallowDBObject, int, error)