private accessor

This commit is contained in:
mr
2024-07-31 10:07:55 +02:00
parent d6a2a416c1
commit 7ae1399a9a
21 changed files with 121 additions and 87 deletions

View File

@@ -58,7 +58,7 @@ func (d *WorkflowExecution) GetName() string {
}
func (d *WorkflowExecution) GetAccessor() utils.Accessor {
data := &WorkflowExecutionMongoAccessor{}
data := New()
data.SetLogger(utils.WORKFLOW_EXECUTION)
return data
}

View File

@@ -5,27 +5,31 @@ import (
"cloud.o-forge.io/core/oc-lib/models/utils"
)
type WorkflowExecutionMongoAccessor struct {
type workflowExecutionMongoAccessor struct {
utils.AbstractAccessor
}
func (wfa *WorkflowExecutionMongoAccessor) DeleteOne(id string) (utils.DBObject, int, error) {
func New() *workflowExecutionMongoAccessor {
return &workflowExecutionMongoAccessor{}
}
func (wfa *workflowExecutionMongoAccessor) DeleteOne(id string) (utils.DBObject, int, error) {
return wfa.GenericDeleteOne(id, wfa)
}
func (wfa *WorkflowExecutionMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
func (wfa *workflowExecutionMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
return wfa.GenericUpdateOne(set, id, wfa, &WorkflowExecution{})
}
func (wfa *WorkflowExecutionMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
func (wfa *workflowExecutionMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
return wfa.GenericStoreOne(data, wfa)
}
func (wfa *WorkflowExecutionMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {
func (wfa *workflowExecutionMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {
return wfa.GenericStoreOne(data, wfa)
}
func (wfa *WorkflowExecutionMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
func (wfa *workflowExecutionMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
var workflow WorkflowExecution
res_mongo, code, err := mongo.MONGOService.LoadOne(id, wfa.GetType())
if err != nil {
@@ -36,7 +40,7 @@ func (wfa *WorkflowExecutionMongoAccessor) LoadOne(id string) (utils.DBObject, i
return &workflow, 200, nil
}
func (wfa WorkflowExecutionMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error) {
func (wfa workflowExecutionMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error) {
objs := []utils.ShallowDBObject{}
res_mongo, code, err := mongo.MONGOService.LoadAll(wfa.GetType())
if err != nil {
@@ -53,7 +57,7 @@ func (wfa WorkflowExecutionMongoAccessor) LoadAll() ([]utils.ShallowDBObject, in
return objs, 200, nil
}
func (wfa *WorkflowExecutionMongoAccessor) Search(word string) ([]utils.ShallowDBObject, int, error) {
func (wfa *workflowExecutionMongoAccessor) Search(word string) ([]utils.ShallowDBObject, int, error) {
objs := []utils.ShallowDBObject{}
res_mongo, code, err := mongo.MONGOService.Search(word, []string{}, wfa.GetType())
if err != nil {