oc-lib/models/workflow/workflow.go
2024-07-22 11:50:14 +02:00

45 lines
795 B
Go

package oclib
import (
"encoding/json"
"fmt"
w "cloud.o-forge.io/core/oc-lib/models/resources/workflow"
"cloud.o-forge.io/core/oc-lib/models/utils"
)
type Workflow struct {
utils.AbstractObject
w.AbstractWorkflow
}
func (d *Workflow) GetName() string {
return d.Name
}
func (d *Workflow) GetAccessor() utils.Accessor {
data := &WorkflowMongoAccessor{}
data.SetLogger(utils.WORKFLOW)
return data
}
func (dma *Workflow) Deserialize(j map[string]interface{}) utils.DBObject {
b, err := json.Marshal(j)
if err != nil {
return nil
}
json.Unmarshal(b, dma)
fmt.Println(j, dma)
return dma
}
func (dma *Workflow) Serialize() map[string]interface{} {
var m map[string]interface{}
b, err := json.Marshal(dma)
if err != nil {
return nil
}
json.Unmarshal(b, dma)
return m
}