oc-lib/models/resources/data/data.go
2024-07-18 11:51:12 +02:00

30 lines
727 B
Go

package data
import (
resources "oc-lib/models/resources"
"oc-lib/models/utils"
)
type Data struct {
resources.AbstractResource
Protocols []string `json:"protocol,omitempty" bson:"protocol,omitempty"` //TODO Enum type
DataType string `json:"datatype" required:"true" bson:"datatype"`
Example string `json:"example" bson:"example" required:"true" validate:"required" description:"base64 encoded data"`
}
func (d *Data) GetType() resources.ResourceType {
return resources.DATA
}
func (d *Data) GetAccessor(driver utils.Driver) utils.Accessor {
var data utils.Accessor
switch driver {
case utils.MONGO:
data = &DataMongoAccessor{}
default:
data = &DataMongoAccessor{}
}
data.SetLogger()
return data
}