27 lines
821 B
Go
27 lines
821 B
Go
package db
|
|
|
|
import (
|
|
cdssdk "gitlink.org.cn/cloudream/common/sdks/storage"
|
|
schmod "gitlink.org.cn/cloudream/scheduler/common/models"
|
|
)
|
|
|
|
type ObjectStorageDB struct {
|
|
*DB
|
|
}
|
|
|
|
func (db *DB) ObjectStorage() *ObjectStorageDB {
|
|
return &ObjectStorageDB{DB: db}
|
|
}
|
|
|
|
//func (*ObjectStorageDB) GetObjectStorageByStorageID(ctx SQLContext, CDSStorageID cdssdk.StorageID) (schmod.ObjectStorage, error) {
|
|
// var ret schmod.ObjectStorage
|
|
// err := sqlx.Get(ctx, &ret, "select * from ObjectStorage where CDSStorageID = ?", CDSStorageID)
|
|
// return ret, err
|
|
//}
|
|
|
|
func (*ObjectStorageDB) GetObjectStorageByStorageID(ctx SQLContext, CDSStorageID cdssdk.StorageID) (schmod.ObjectStorage, error) {
|
|
var ret schmod.ObjectStorage
|
|
err := ctx.Table("ObjectStorage").Where("CDSStorageID = ?", CDSStorageID).First(&ret).Error
|
|
return ret, err
|
|
}
|