interface_abstract

package
v0.0.0-...-184aab5 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const BucketName = "ai_images_bucket"

Variables

This section is empty.

Functions

This section is empty.

Types

type AliyunImageStore

type AliyunImageStore struct{}

AliyunImageStore 为了代码复用,封装图片存储相关逻辑,统一提供AliyunImageStore类,供整个系统使用

func CreateAliyunImageStore

func CreateAliyunImageStore() *AliyunImageStore

func (*AliyunImageStore) CreateBucketIfNotExisting

func (s *AliyunImageStore) CreateBucketIfNotExisting(bucketName string) error

CreateBucketIfNotExisting 创建 bucket,失败则返回错误

func (*AliyunImageStore) DownloadFromAliyun

func (s *AliyunImageStore) DownloadFromAliyun(url string, accessToken string) image.Image

DownloadFromAliyun 从阿里云下载图片

func (*AliyunImageStore) GenerateAccessToken

func (s *AliyunImageStore) GenerateAccessToken() string

GenerateAccessToken 根据 accessKey / secretKey 等生成 access token

func (*AliyunImageStore) UploadToAliyun

func (s *AliyunImageStore) UploadToAliyun(image image.Image, bucketName string, accessToken string) string

UploadToAliyun 上传图片到阿里云,返回图片存储的url

type Application

type Application struct {
	// contains filtered or unexported fields
}

Application 过滤器使用类

func (Application) HandleRPCRequest

func (a Application) HandleRPCRequest(req rpc.Request) error

type AuthenticationFilter

type AuthenticationFilter struct{}

AuthenticationFilter 接口实现类:鉴权过滤器

type FileLogger

type FileLogger struct {
	// contains filtered or unexported fields
}

func NewFileLogger

func NewFileLogger(name string, enabled bool, minPermittedLevel Level, filePath string) (*FileLogger, error)

func (FileLogger) Log

func (l FileLogger) Log(level Level, message string)

type Filter

type Filter interface {
	// contains filtered or unexported methods
}

Filter 接口

type ImageProcessingJob

type ImageProcessingJob struct{}

ImageProcessingJob 是上传图片的一个示例

func (ImageProcessingJob) Process

func (j ImageProcessingJob) Process(filePath string) error

type ImageStore

type ImageStore interface {
	Upload(image image.Image, bucketName string) (string, error)
	Download(url string) image.Image
}

type Level

type Level struct {
	Value int
}

type MessageQueueLogger

type MessageQueueLogger struct {
	// contains filtered or unexported fields
}

func NewMessageQueueLogger

func NewMessageQueueLogger(name string, enabled bool, minPermittedLevel Level, msgQueueProducer sarama.AsyncProducer) *MessageQueueLogger

func (MessageQueueLogger) Log

func (l MessageQueueLogger) Log(level Level, message string)

type NewAliyunImageStore

type NewAliyunImageStore struct{}

NewAliyunImageStore 重构之后的代码,为了避免和原来的命名冲突,前面增加New

func CreateNewAliyunImageStore

func CreateNewAliyunImageStore() *NewAliyunImageStore

func (*NewAliyunImageStore) Download

func (n *NewAliyunImageStore) Download(url string) image.Image

Download 从阿里云下载图片

func (*NewAliyunImageStore) Upload

func (n *NewAliyunImageStore) Upload(image image.Image, bucketName string) (string, error)

Upload 上传图片到阿里云,并返回图片存储的 URL

type NewImageProcessingJob

type NewImageProcessingJob struct{}

NewImageProcessingJob 与上面的示例进行区分,命名前缀增加 New

func (NewImageProcessingJob) Process

func (j NewImageProcessingJob) Process(filePath string) error

type PrivateImageStore

type PrivateImageStore struct{}

func CreatePrivateImageStore

func CreatePrivateImageStore() *PrivateImageStore

func (*PrivateImageStore) Download

func (p *PrivateImageStore) Download(url string) image.Image

Download 从私有云下载图片

func (*PrivateImageStore) Upload

func (p *PrivateImageStore) Upload(image image.Image, bucketName string) (string, error)

Upload 上传图片到私有云,并返回图片存储 URL

type RateLimitFilter

type RateLimitFilter struct{}

RateLimitFilter 接口实现类:限流过滤器

Jump to

Keyboard shortcuts

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