omitempty
This commit is contained in:
parent
ebdbd97ce6
commit
e44a6b65b7
models
@ -10,8 +10,8 @@ import (
|
|||||||
type DataResource struct {
|
type DataResource struct {
|
||||||
resources.AbstractResource
|
resources.AbstractResource
|
||||||
Protocols []string `json:"protocol,omitempty" bson:"protocol,omitempty"` //TODO Enum type
|
Protocols []string `json:"protocol,omitempty" bson:"protocol,omitempty"` //TODO Enum type
|
||||||
DataType string `json:"datatype,omitempty" bson:"datatype"`
|
DataType string `json:"datatype,omitempty" bson:"datatype,omitempty"`
|
||||||
Example string `json:"example,omitempty" bson:"example" description:"base64 encoded data"`
|
Example string `json:"example,omitempty" bson:"example,omitempty" description:"base64 encoded data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dma *DataResource) Deserialize(j map[string]interface{}) utils.DBObject {
|
func (dma *DataResource) Deserialize(j map[string]interface{}) utils.DBObject {
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
type DatacenterResource struct {
|
type DatacenterResource struct {
|
||||||
resources.AbstractResource
|
resources.AbstractResource
|
||||||
BookingPrice int `bson:"booking_price" json:"booking_price,omitempty"`
|
BookingPrice int `bson:"booking_price,omitempty" json:"booking_price,omitempty"`
|
||||||
|
|
||||||
CPU *DatacenterCpuModel `bson:"cpu,omitempty" json:"cpu,omitempty"`
|
CPU *DatacenterCpuModel `bson:"cpu,omitempty" json:"cpu,omitempty"`
|
||||||
RAM *DatacenterMemoryModel `bson:"ram,omitempty" json:"ram,omitempty"`
|
RAM *DatacenterMemoryModel `bson:"ram,omitempty" json:"ram,omitempty"`
|
||||||
|
@ -16,12 +16,12 @@ type Resource interface {
|
|||||||
|
|
||||||
type AbstractResource struct {
|
type AbstractResource struct {
|
||||||
utils.AbstractObject
|
utils.AbstractObject
|
||||||
ShortDescription string `json:"short_description" bson:"short_description" validate:"required"`
|
ShortDescription string `json:"short_description,omitempty" bson:"short_description,omitempty" validate:"required"`
|
||||||
Description string `json:"description,omitempty" bson:"description"`
|
Description string `json:"description,omitempty" bson:"description,omitempty"`
|
||||||
Logo string `json:"logo" bson:"logo" validate:"required"`
|
Logo string `json:"logo,omitempty" bson:"logo,omitempty" validate:"required"`
|
||||||
Owner string `json:"owner" bson:"owner" validate:"required"`
|
Owner string `json:"owner,omitempty" bson:"owner,omitempty" validate:"required"`
|
||||||
OwnerLogo string `json:"owner_logo" bson:"owner_logo"`
|
OwnerLogo string `json:"owner_logo,omitempty" bson:"owner_logo,omitempty"`
|
||||||
SourceUrl string `json:"source_url" bson:"source_url" validate:"required"`
|
SourceUrl string `json:"source_url,omitempty" bson:"source_url,omitempty" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *AbstractResource) GetID() string {
|
func (r *AbstractResource) GetID() string {
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type URL struct {
|
type URL struct {
|
||||||
Protocol string `bson:"protocol,omitempty" json:"protocol"`
|
Protocol string `bson:"protocol,omitempty" json:"protocol,omitempty"`
|
||||||
Path string `bson:"path,omitempty" json:"path"`
|
Path string `bson:"path,omitempty" json:"path,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type StorageResource struct {
|
type StorageResource struct {
|
||||||
|
@ -11,8 +11,8 @@ import (
|
|||||||
var validate = validator.New(validator.WithRequiredStructEnabled())
|
var validate = validator.New(validator.WithRequiredStructEnabled())
|
||||||
|
|
||||||
type AbstractObject struct {
|
type AbstractObject struct {
|
||||||
UUID string `json:"id" required:"true" bson:"id" validate:"required"`
|
UUID string `json:"id,omitempty" bson:"id,omitempty" validate:"required"`
|
||||||
Name string `json:"name" required:"true" bson:"name" validate:"required"`
|
Name string `json:"name,omitempty" bson:"name,omitempty" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ao *AbstractObject) GetID() string {
|
func (ao *AbstractObject) GetID() string {
|
||||||
|
Loading…
Reference in New Issue
Block a user