add a web resource concept for data + storage
This commit is contained in:
@@ -13,10 +13,9 @@ import (
|
||||
* it defines the resource data
|
||||
*/
|
||||
type DataResource struct {
|
||||
resource_model.AbstractResource // AbstractResource contains the basic fields of an object (id, name)
|
||||
Protocols []string `json:"protocol,omitempty" bson:"protocol,omitempty"` //TODO Enum type
|
||||
DataType string `json:"datatype,omitempty" bson:"datatype,omitempty"` // DataType is the type of the data
|
||||
Example string `json:"example,omitempty" bson:"example,omitempty" description:"base64 encoded data"` // Example is an example of the data
|
||||
resource_model.AbstractResource // AbstractResource contains the basic fields of an object (id, name)
|
||||
resource_model.WebResource
|
||||
Example string `json:"example,omitempty" bson:"example,omitempty" description:"base64 encoded data"` // Example is an example of the data
|
||||
}
|
||||
|
||||
func (dma *DataResource) Deserialize(j map[string]interface{}) utils.DBObject {
|
||||
|
@@ -10,7 +10,11 @@ import (
|
||||
)
|
||||
|
||||
func TestStoreOneData(t *testing.T) {
|
||||
d := DataResource{DataType: "jpeg", Example: "123456",
|
||||
d := DataResource{
|
||||
WebResource: resource_model.WebResource{
|
||||
Type: "jpeg", Protocol: "http", Path: "azerty.fr",
|
||||
},
|
||||
Example: "123456",
|
||||
AbstractResource: resource_model.AbstractResource{
|
||||
AbstractObject: utils.AbstractObject{Name: "testData"},
|
||||
Description: "Lorem Ipsum",
|
||||
@@ -28,7 +32,11 @@ func TestStoreOneData(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoadOneDate(t *testing.T) {
|
||||
d := DataResource{DataType: "jpeg", Example: "123456",
|
||||
d := DataResource{
|
||||
WebResource: resource_model.WebResource{
|
||||
Type: "jpeg", Protocol: "http", Path: "azerty.fr",
|
||||
},
|
||||
Example: "123456",
|
||||
AbstractResource: resource_model.AbstractResource{
|
||||
AbstractObject: utils.AbstractObject{Name: "testData"},
|
||||
Description: "Lorem Ipsum",
|
||||
|
Reference in New Issue
Block a user