oc-lib/models/utils/interfaces.go

29 lines
691 B
Go
Raw Normal View History

2024-07-18 11:51:12 +02:00
package utils
2024-07-23 11:22:50 +02:00
type ShallowDBObject interface {
GenerateID()
GetID() string
GetName() string
}
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-07-18 15:02:39 +02:00
GetAccessor() Accessor
2024-07-18 11:51:12 +02:00
}
type Accessor interface {
2024-07-19 10:54:58 +02:00
SetLogger(t DataType)
2024-07-18 16:46:54 +02:00
GetType() string
2024-07-26 13:45:10 +02:00
Search(word 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
}