access func
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
resources "cloud.o-forge.io/core/oc-lib/models/resources"
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
tool "cloud.o-forge.io/core/oc-lib/utils"
|
||||
)
|
||||
|
||||
type URL struct {
|
||||
@@ -22,14 +25,23 @@ type Storage struct {
|
||||
BookingPrice uint `bson:"booking_price,omitempty" json:"booking_price,omitempty"`
|
||||
}
|
||||
|
||||
func (dma *Storage) Deserialize(j map[string]interface{}) utils.DBObject {
|
||||
b, err := json.Marshal(j)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
json.Unmarshal(b, dma)
|
||||
return dma
|
||||
}
|
||||
|
||||
func (s *Storage) GetType() resources.ResourceType {
|
||||
return resources.STORAGE
|
||||
}
|
||||
|
||||
func (d *Storage) GetAccessor(driver utils.Driver) utils.Accessor {
|
||||
func (d *Storage) GetAccessor(driver tool.Driver) utils.Accessor {
|
||||
var data utils.Accessor
|
||||
switch driver {
|
||||
case utils.MONGO:
|
||||
case tool.MONGO:
|
||||
data = &StorageMongoAccessor{}
|
||||
default:
|
||||
data = &StorageMongoAccessor{}
|
||||
|
Reference in New Issue
Block a user