storage

package
v0.0.0-...-5105834 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitImageFinder

func InitImageFinder(ctx context.Context) error

Types

type Image

type Image struct {
	// 图片类型
	Type string
	// 原始数据长度(字节)
	OriginalSize int
	// 处理后数据长度(字节)
	Size int
	// 图片宽度
	Width int
	// 图片高度
	Height int
	// 图片数据
	Data []byte
	// contains filtered or unexported fields
}

func GetImageFromURL

func GetImageFromURL(ctx context.Context, url string) (*Image, error)

func NewImageFromBytes

func NewImageFromBytes(data []byte) (*Image, error)

func (*Image) Image

func (i *Image) Image() (image.Image, error)

func (*Image) SetData

func (i *Image) SetData(data []byte)

type ImageFilterParams

type ImageFilterParams struct {
	// 筛选的字段
	Fields string `json:"fields"`
	// 数量
	Limit int `json:"limit"`
	// 偏移量
	Offset int `json:"offset"`
}

type ImageFinder

type ImageFinder func(ctx context.Context, params ...string) (*Image, error)

func GetFinder

func GetFinder(name string) (ImageFinder, error)

type ImageStorage

type ImageStorage interface {
	Get(ctx context.Context, bucket, filename string) (*ent.Image, error)
	Put(ctx context.Context, file ent.Image) error
	Query(ctx context.Context, params ImageFilterParams) ([]*ent.Image, error)
	Count(ctx context.Context, params ImageFilterParams) (int64, error)
}

func Ent

func Ent() ImageStorage

Jump to

Keyboard shortcuts

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