Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// Put returns link {Domain}/{Bucket}/{Category}/{RandPrefix}/{Filename}
Put(ctx context.Context, category, filename string, size int64, body io.Reader) (link string, err error)
// PutFile is alias Put with opening local file
PutFile(ctx context.Context, category, filepath string) (link string, err error)
// PutData is alias Put
PutData(ctx context.Context, category, filename string, data []byte) (link string, err error)
// PutImage ...
PutImage(
ctx context.Context, category, filename string, img image.Image, typ ImageType) (link string, err error)
// PutMultipartThumbnail ...
PutMultipartThumbnail(
ctx context.Context, category string,
file *multipart.FileHeader, typ ImageType, maxPixelSize uint) (link string, err error)
}
Client of S3 storage
For opening use func Open
type Config ¶
type Config struct {
RandPrefixLen int `yaml:"rand_prefix_len"` // rand file prefix for safe
S3Mode bool `yaml:"s3_mode"` // enable s3 storage for files
LocalDir string `yaml:"local_dir"` // local storage directory
LocalURL string `yaml:"local_url"` // target url file prefix
S3AccessKey string `yaml:"s3_access_key"` // access key or login or user, for example: 32423_goservice
S3SecretKey string `yaml:"s3_secret_key"` // secret key or password
S3AuthToken string `yaml:"s3_auth_token"` // optional
S3EndPoint string `yaml:"s3_end_point"` // provider api url, for example: s3.selcdn.ru
S3Domain string `yaml:"s3_domain"` // storage domain, for example: https://56756.selcdn.ru
S3Region string `yaml:"s3_region"` // for example: ru-1a
S3Bucket string `yaml:"s3_bucket"` // service bucket root, for example: goservice
S3Insecure bool `yaml:"s3_insecure"`
}
Config for local storage or s3 connection
func (*Config) ValidAndRepair ¶
Click to show internal directories.
Click to hide internal directories.