38 lines
760 B
Go
38 lines
760 B
Go
package oclib
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
|
)
|
|
|
|
type WorkflowResource struct {
|
|
utils.AbstractResource
|
|
WorkflowID string `bson:"workflow_id,omitempty" json:"workflow_id,omitempty"`
|
|
}
|
|
|
|
func (d *WorkflowResource) GetAccessor() utils.Accessor {
|
|
data := &WorkflowResourceMongoAccessor{}
|
|
data.SetLogger(utils.WORKFLOW_RESOURCE)
|
|
return data
|
|
}
|
|
|
|
func (dma *WorkflowResource) Deserialize(j map[string]interface{}) utils.DBObject {
|
|
b, err := json.Marshal(j)
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
json.Unmarshal(b, dma)
|
|
return dma
|
|
}
|
|
|
|
func (dma *WorkflowResource) Serialize() map[string]interface{} {
|
|
var m map[string]interface{}
|
|
b, err := json.Marshal(dma)
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
json.Unmarshal(b, &m)
|
|
return m
|
|
}
|