Documentation ¶
Index ¶
- Constants
- type AliyunImageStore
- func (s *AliyunImageStore) CreateBucketIfNotExisting(bucketName string) error
- func (s *AliyunImageStore) DownloadFromAliyun(url string, accessToken string) image.Image
- func (s *AliyunImageStore) GenerateAccessToken() string
- func (s *AliyunImageStore) UploadToAliyun(image image.Image, bucketName string, accessToken string) string
- type Application
- type AuthenticationFilter
- type FileLogger
- type Filter
- type ImageProcessingJob
- type ImageStore
- type Level
- type MessageQueueLogger
- type NewAliyunImageStore
- type NewImageProcessingJob
- type PrivateImageStore
- type RateLimitFilter
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 FileLogger ¶
type FileLogger struct {
// contains filtered or unexported fields
}
func NewFileLogger ¶
func (FileLogger) Log ¶
func (l FileLogger) Log(level Level, message string)
type ImageProcessingJob ¶
type ImageProcessingJob struct{}
ImageProcessingJob 是上传图片的一个示例
func (ImageProcessingJob) Process ¶
func (j ImageProcessingJob) Process(filePath string) error
type ImageStore ¶
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
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
Click to show internal directories.
Click to hide internal directories.