feat(storage): add cos support
This commit is contained in:
@@ -3,7 +3,6 @@ package model
|
||||
import (
|
||||
"context"
|
||||
"net/url"
|
||||
"octopus/internal/config"
|
||||
"octopus/internal/dal"
|
||||
"time"
|
||||
|
||||
@@ -37,15 +36,14 @@ type Doc struct {
|
||||
IsDeletable bool `gorm:"column:is_deletable;type:boolean;not null;default:true"` // 是否允许被删除
|
||||
IsEditable bool `gorm:"column:is_editable;type:boolean;not null;default:true"` // 是否允许编辑名称
|
||||
FolderID string `gorm:"column:folder_id;type:varchar;index:idx_folder_id"` // 文件夹ID
|
||||
OSSObjectID string `gorm:"column:oss_object_id;type:varchar"` // OSS Object ID
|
||||
ObjectName string `gorm:"column:object_name;type:varchar"` // 对象存储中对应的object_name
|
||||
CreatedBy string `gorm:"column:created_by;type:varchar;not null"` // 创建人
|
||||
|
||||
Folder *DocFolder `gorm:"foreignKey:FolderID;references:ID"`
|
||||
}
|
||||
|
||||
func (df *Doc) PresignedURL(ctx context.Context) (*url.URL, error) {
|
||||
bucket := config.Get().GetOSSConfig().Bucket
|
||||
return dal.GetMinio().PresignedGetObject(ctx, bucket, df.OSSObjectID, time.Hour, nil)
|
||||
return dal.GetStorage().PresignedGetObject(ctx, df.ObjectName, time.Hour)
|
||||
}
|
||||
|
||||
func (*Doc) TableName() string {
|
||||
|
||||
Reference in New Issue
Block a user