Documentation ¶
Index ¶
- Variables
- func AppToEntity(m App) *repository.App
- func BucketToEntity(m Bucket) *repository.Bucket
- func DeleteAppById(id int64) (int64, error)
- func DeleteBucketById(id int64) (int64, error)
- func GetDB() *xorm.Engine
- func GetDatabases() map[string]*xorm.Engine
- func InitDB(config *viper.Viper)
- func InitNacos()
- func IsValidObjectID(s string) bool
- func SyncDB() error
- type App
- type Bucket
- type File
- type ObjectID
- func (id ObjectID) Hex() string
- func (id ObjectID) IsZero() bool
- func (id ObjectID) MarshalJSON() ([]byte, error)
- func (id ObjectID) MarshalText() ([]byte, error)
- func (id ObjectID) String() string
- func (id ObjectID) Timestamp() time.Time
- func (id *ObjectID) UnmarshalJSON(b []byte) error
- func (id *ObjectID) UnmarshalText(b []byte) error
- type OssUploadFile
- type OssUploadToken
- type PageParam
- type PageResult
- type ProcessConfig
- type ProcessParam
- type RestResult
- type SearchFilePageParam
- type SearchFileParam
- type UploadFileRequest
- type WebResult
Constants ¶
This section is empty.
Variables ¶
var (
Config *viper.Viper
)
var ErrInvalidHex = fmt.Errorf("the provided hex string is not a valid ObjectID")
ErrInvalidHex indicates that a hex string cannot be converted to an ObjectID.
Functions ¶
func AppToEntity ¶
func AppToEntity(m App) *repository.App
func BucketToEntity ¶
func BucketToEntity(m Bucket) *repository.Bucket
func DeleteAppById ¶
func DeleteBucketById ¶
func GetDatabases ¶
func IsValidObjectID ¶
IsValidObjectID returns true if the provided hex string represents a valid ObjectID and false if not.
Types ¶
type App ¶
type App struct { Id int64 `json:"id"` AccessKeyId string `json:"accessKeyId"` AccessKeySecret string `json:"accessKeySecret"` Endpoint string `json:"endpoint"` InnerEndpoint string `json:"innerEndpoint"` Status int `json:"status"` CreateTime string `json:"createTime"` UpdateTime string `json:"updateTime"` }
func EntityToApp ¶
func EntityToApp(entity repository.App) *App
type Bucket ¶
type Bucket struct { Id int64 `json:"id"` AppId int64 `json:"appId"` BucketType int `json:"bucketType"` Name string `json:"name"` Domain string `json:"domain"` ProcessConfig *ProcessConfig `json:"processConfig"` Status int `json:"status"` CreateTime string `json:"createTime"` UpdateTime string `json:"updateTime"` }
func CreateBucket ¶
func EntityToBucket ¶
func EntityToBucket(entity repository.Bucket) *Bucket
func UpdateBucket ¶
type File ¶
type File struct { Id int64 `json:"id"` BucketId int64 `json:"bucketId"` BucketName string `json:"bucketName"` Domain string `json:"domain"` FileKey string `json:"fileKey"` SourceFile string `json:"sourceFile"` SourceFileSize int64 `json:"sourceFileSize"` SourceFileType string `json:"sourceFileType"` SourceFileAttr string `json:"sourceFileAttr"` Url string `json:"url"` CreateTime string `json:"createTime"` UpdateTime string `json:"updateTime"` }
func BatchCreateFile ¶
func CreateFileData ¶
func SearchFiles ¶
func SearchFiles(searchParam SearchFileParam) ([]File, error)
func UploadFile ¶
func UploadFile(uploadFile OssUploadFile, file string) (*File, error)
type ObjectID ¶
type ObjectID [12]byte
ObjectID is the BSON ObjectID type.
var NilObjectID ObjectID
NilObjectID is the zero value for ObjectID.
func NewObjectIDFromTimestamp ¶
NewObjectIDFromTimestamp generates a new ObjectID based on the given time.
func ObjectIDFromHex ¶
ObjectIDFromHex creates a new ObjectID from a hex string. It returns an error if the hex string is not a valid ObjectID.
func (ObjectID) MarshalJSON ¶
MarshalJSON returns the ObjectID as a string
func (ObjectID) MarshalText ¶
MarshalText returns the ObjectID as UTF-8-encoded text. Implementing this allows us to use ObjectID as a map key when marshalling JSON. See https://pkg.go.dev/encoding#TextMarshaler
func (*ObjectID) UnmarshalJSON ¶
UnmarshalJSON populates the byte slice with the ObjectID. If the byte slice is 24 bytes long, it will be populated with the hex representation of the ObjectID. If the byte slice is twelve bytes long, it will be populated with the BSON representation of the ObjectID. This method also accepts empty strings and decodes them as NilObjectID. For any other inputs, an error will be returned.
func (*ObjectID) UnmarshalText ¶
UnmarshalText populates the byte slice with the ObjectID. Implementing this allows us to use ObjectID as a map key when unmarshalling JSON. See https://pkg.go.dev/encoding#TextUnmarshaler
type OssUploadFile ¶
type OssUploadFile struct { Bucket string `json:"bucket" form:"bucket"` //bucket名称 Prefix string `json:"prefix" form:"prefix"` //文件前缀 FileKey string `json:"fileKey" form:"fileKey"` //文件key SourceFile string `json:"sourceFile" form:"sourceFile"` //源文件 SourceFileSize int64 `json:"sourceFileSize" form:"sourceFileSize"` //源文件大小 SourceFileType string `json:"sourceFileType" form:"sourceFileType"` //源文件类型 SourceFileAttr string `json:"sourceFileAttr" form:"sourceFileAttr"` //源文件属性 UseSourceFilename int `json:"useSourceFilename" form:"useSourceFilename"` //是否使用源文件名 ExpiredInSec int64 `json:"expiredInSec" form:"expiredInSec"` //过期秒数 ProcessParams []ProcessParam `json:"processParams"` //处理参数 ProcessParamsStr string `form:"processParams"` //处理参数 }
type OssUploadToken ¶
type OssUploadToken struct { FileId int64 `json:"fileId"` //文件ID UploadUrl string `json:"uploadUrl"` //上传地址 AccessKeyId string `json:"accessKeyId"` //OSS秘钥ID Policy string `json:"policy"` //策略 Signature string `json:"signature"` //签名 Key string `json:"key"` //文件键值 Url string `json:"url"` //文件地址 }
func GetUploadToken ¶
func GetUploadToken(uploadFile OssUploadFile) (*OssUploadToken, error)
type PageResult ¶
type PageResult struct { Total int64 `json:"total"` TotalPages int64 `json:"totalPages"` Data []any `json:"data"` }
func NewPageResult ¶
func NewPageResult() *PageResult
func SearchApps ¶
func SearchApps(searchParam PageParam) (PageResult, error)
func SearchBuckets ¶
func SearchBuckets(searchParam PageParam) (PageResult, error)
func SearchPageFiles ¶
func SearchPageFiles(searchParam SearchFilePageParam) (PageResult, error)
func (*PageResult) GetTotalPages ¶
func (m *PageResult) GetTotalPages(pageSize int) int64
type ProcessConfig ¶
type ProcessConfig struct { Expression string `json:"expression"` // 表达式 ProcessParams []ProcessParam `json:"processParams"` //处理参数 }
type ProcessParam ¶
type RestResult ¶
type SearchFilePageParam ¶
type SearchFilePageParam struct { PageParam SearchFileParam }
type SearchFileParam ¶
type SearchFileParam struct { Ids []int64 `json:"ids"` //文件ID集合 FileKeys []string `json:"fileKeys"` //文件key集合 Buckets []string `json:"buckets"` //bucket集合 ExpiredInSec int64 `json:"expiredInSec"` //过期秒数 ProcessParams []ProcessParam `json:"processParams"` //处理参数 }
type UploadFileRequest ¶
type UploadFileRequest struct {
SourceFile string `json:"sourceFile"` //原文件名
}