2024-07-18 11:51:12 +02:00
|
|
|
package utils
|
|
|
|
|
2024-08-12 16:11:25 +02:00
|
|
|
import (
|
|
|
|
"cloud.o-forge.io/core/oc-lib/dbs"
|
|
|
|
"cloud.o-forge.io/core/oc-lib/tools"
|
|
|
|
)
|
2024-08-01 09:13:10 +02:00
|
|
|
|
2024-07-23 11:22:50 +02:00
|
|
|
type ShallowDBObject interface {
|
|
|
|
GenerateID()
|
|
|
|
GetID() string
|
|
|
|
GetName() string
|
2024-08-05 10:10:58 +02:00
|
|
|
Deserialize(j map[string]interface{}) DBObject
|
|
|
|
Serialize() map[string]interface{}
|
2024-07-23 11:22:50 +02:00
|
|
|
}
|
|
|
|
|
2024-07-18 11:51:12 +02:00
|
|
|
type DBObject interface {
|
2024-07-19 10:54:58 +02:00
|
|
|
GenerateID()
|
2024-07-19 13:27:34 +02:00
|
|
|
GetID() string
|
2024-07-18 11:51:12 +02:00
|
|
|
GetName() string
|
2024-07-18 14:39:54 +02:00
|
|
|
Deserialize(j map[string]interface{}) DBObject
|
2024-07-19 09:32:58 +02:00
|
|
|
Serialize() map[string]interface{}
|
2024-08-12 16:11:25 +02:00
|
|
|
GetAccessor(caller *tools.HTTPCaller) Accessor
|
2024-07-18 11:51:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type Accessor interface {
|
2024-08-12 16:11:25 +02:00
|
|
|
Init(t DataType, caller *tools.HTTPCaller)
|
2024-07-18 16:46:54 +02:00
|
|
|
GetType() string
|
2024-08-12 16:11:25 +02:00
|
|
|
GetCaller() *tools.HTTPCaller
|
2024-08-01 09:13:10 +02:00
|
|
|
Search(filters *dbs.Filters, search string) ([]ShallowDBObject, int, error)
|
2024-07-23 11:22:50 +02:00
|
|
|
LoadAll() ([]ShallowDBObject, int, error)
|
2024-07-19 11:27:58 +02:00
|
|
|
LoadOne(id string) (DBObject, int, error)
|
|
|
|
DeleteOne(id string) (DBObject, int, error)
|
2024-07-19 13:41:10 +02:00
|
|
|
CopyOne(data DBObject) (DBObject, int, error)
|
2024-07-19 11:27:58 +02:00
|
|
|
StoreOne(data DBObject) (DBObject, int, error)
|
2024-07-22 16:12:38 +02:00
|
|
|
UpdateOne(set DBObject, id string) (DBObject, int, error)
|
2024-07-18 11:51:12 +02:00
|
|
|
}
|