resource

package
v1.5.6-perf-and-mqtt Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckExist added in v1.4.6

func CheckExist(ctx context.Context, id types.SFID) bool

func CheckFileMd5SumAndGetData added in v1.1.0

func CheckFileMd5SumAndGetData(ctx context.Context, fh *multipart.FileHeader, md5Str string) (data []byte, sum string, err error)

func Create added in v1.1.0

func Create(ctx context.Context, acc types.SFID, fh *multipart.FileHeader, filename, md5 string) (*models.Resource, []byte, error)

func GetByMd5 added in v1.1.0

func GetByMd5(ctx context.Context, md5 string) (*models.Resource, error)

func GetBySFID added in v1.1.0

func GetBySFID(ctx context.Context, id types.SFID) (*models.Resource, error)

func GetContentByMd5 added in v1.1.0

func GetContentByMd5(ctx context.Context, md5 string) (*models.Resource, []byte, error)

func GetContentBySFID added in v1.1.0

func GetContentBySFID(ctx context.Context, id types.SFID) (*models.Resource, []byte, error)

func GetOwnerByAccountAndSFID added in v1.1.0

func GetOwnerByAccountAndSFID(ctx context.Context, acc, res types.SFID) (*models.ResourceOwnership, error)

func ReadContent added in v1.1.0

func ReadContent(ctx context.Context, m *models.Resource) ([]byte, error)

func RemoveOwnershipBySFID added in v1.1.0

func RemoveOwnershipBySFID(ctx context.Context, id types.SFID) error

func UploadFile added in v1.1.0

func UploadFile(ctx context.Context, data []byte, id types.SFID) (path string, err error)

Types

type CondArgs added in v1.1.0

type CondArgs struct {
	AccountID      types.SFID      `name:"-"`
	ResourceIDs    []types.SFID    `in:"query" name:"resourceID,omitempty"`
	UploadedBefore types.Timestamp `in:"query" name:"uploadedBefore,omitempty"`
	UploadedAfter  types.Timestamp `in:"query" name:"uploadedAfter,omitempty"`
	ExpireBefore   types.Timestamp `in:"query" name:"expireBefore,omitempty"`
	ExpireAfter    types.Timestamp `in:"query" name:"expireAfter,omitempty"`
	FilenameLike   string          `in:"query" name:"filenameLike,omitempty"`
	Filenames      []string        `in:"query" name:"filename,omitempty"`
	Md5            string          `in:"query" name:"md5,omitempty"`
}

func (*CondArgs) Condition added in v1.1.0

func (r *CondArgs) Condition() builder.SqlCondition

type DownLoadResourceRsp added in v1.2.3

type DownLoadResourceRsp struct {
	FileName string `json:"fileName"`
	Url      string `json:"url"`
}

func GetDownloadUrlBySFID added in v1.2.3

func GetDownloadUrlBySFID(ctx context.Context, id types.SFID) (*DownLoadResourceRsp, error)

type ListReq added in v1.1.0

type ListReq struct {
	CondArgs
	datatypes.Pager
}

type ListRsp added in v1.1.0

type ListRsp struct {
	Data  []*ResourceInfo `json:"data"`
	Total int64           `json:"total"`
}

func List added in v1.1.0

func List(ctx context.Context, r *ListReq) (*ListRsp, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL