package data import ( "encoding/json" "cloud.o-forge.io/core/oc-lib/models/resource_model" "cloud.o-forge.io/core/oc-lib/models/utils" ) type DataResource struct { resource_model.AbstractResource Protocols []string `json:"protocol,omitempty" bson:"protocol,omitempty"` //TODO Enum type DataType string `json:"datatype,omitempty" bson:"datatype,omitempty"` Example string `json:"example,omitempty" bson:"example,omitempty" description:"base64 encoded data"` } func (dma *DataResource) 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 *DataResource) 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 } func (d *DataResource) GetAccessor() utils.Accessor { data := &DataMongoAccessor{} data.SetLogger(utils.DATA_RESOURCE) return data }