Documentation ¶
Index ¶
- Constants
- type AppEnv
- type Conf
- type ConfOption
- type DataBaseConf
- type File
- type FileStorage
- func (s *FileStorage) DownloadFile(path string, targetPath string) error
- func (s *FileStorage) MultiPartDownload(path string, targetFile *os.File, partOffset, partSize int64) error
- func (s *FileStorage) MultipartUploadByFileHeader(fileHeader *multipart.FileHeader, processFunc func(part types.Part)) error
- func (s *FileStorage) MultipartUploadByPath(path string, processFunc func(part types.Part)) error
- func (s *FileStorage) SetUploadChunkSize(chunkSize int64)
- func (s *FileStorage) Stat(path string) (*types.Object, error)
- func (s *FileStorage) UploadByFileHeader(fileHeader *multipart.FileHeader, processFunc func(bs []byte), auto bool) error
- func (s *FileStorage) UploadByPath(path string, processFunc func(bs []byte), auto bool) error
- type HttpConf
- type LogConf
- type ServerConf
Constants ¶
View Source
const ( // Dev 开发环境 Dev = "dev" // Test 测试环境 Test = "test" // Gray 灰度环境 Gray = "gray" // Production 正式环境 Production = "production" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conf ¶
type Conf struct { AppEnv AppEnv `yaml:"app_env"` AppName string `yaml:"app_name"` Server *ServerConf `yaml:"server"` Log *LogConf `yaml:"logger"` Databases map[string]*DataBaseConf `yaml:"databases"` File *File `yaml:"file"` // contains filtered or unexported fields }
func NewConf ¶
func NewConf(opts ...ConfOption) *Conf
type ConfOption ¶
type ConfOption func(c *Conf)
func WithConfFile ¶
func WithConfFile(path string) ConfOption
type DataBaseConf ¶
type File ¶ added in v0.1.8
type File struct { Default string `yaml:"default"` Local struct { RootDir string `yaml:"root"` } `yaml:"local"` OSS struct { AccessId string `yaml:"access_id"` AccessSecret string `yaml:"access_secret"` Bucket string `yaml:"bucket"` Endpoint string `yaml:"endpoint"` } `yaml:"oss"` COS struct { Region string `yaml:"region"` AppId string `yaml:"app_id"` SecretID string `yaml:"secret_id"` SecretKey string `yaml:"secret_key"` Bucket string `yaml:"bucket"` } }
func (*File) GetBaseUrl ¶ added in v0.1.17
func (*File) GetStorage ¶ added in v0.1.8
func (f *File) GetStorage(workDir string) (*FileStorage, error)
type FileStorage ¶ added in v0.1.8
type FileStorage struct {
// contains filtered or unexported fields
}
func (*FileStorage) DownloadFile ¶ added in v0.1.8
func (s *FileStorage) DownloadFile(path string, targetPath string) error
func (*FileStorage) MultiPartDownload ¶ added in v0.1.8
func (s *FileStorage) MultiPartDownload(path string, targetFile *os.File, partOffset, partSize int64) error
MultiPartDownload 多块并行下载 todo not final
func (*FileStorage) MultipartUploadByFileHeader ¶ added in v0.1.15
func (s *FileStorage) MultipartUploadByFileHeader(fileHeader *multipart.FileHeader, processFunc func(part types.Part)) error
func (*FileStorage) MultipartUploadByPath ¶ added in v0.1.15
func (s *FileStorage) MultipartUploadByPath(path string, processFunc func(part types.Part)) error
func (*FileStorage) SetUploadChunkSize ¶ added in v0.1.31
func (s *FileStorage) SetUploadChunkSize(chunkSize int64)
func (*FileStorage) Stat ¶ added in v0.1.14
func (s *FileStorage) Stat(path string) (*types.Object, error)
func (*FileStorage) UploadByFileHeader ¶ added in v0.1.15
func (s *FileStorage) UploadByFileHeader(fileHeader *multipart.FileHeader, processFunc func(bs []byte), auto bool) error
func (*FileStorage) UploadByPath ¶ added in v0.1.15
func (s *FileStorage) UploadByPath(path string, processFunc func(bs []byte), auto bool) error
type LogConf ¶
type LogConf struct { lumberjack.Logger LogDir string `yaml:"log_dir"` }
func (*LogConf) LoggerInit ¶
LoggerInit 日志初始化
type ServerConf ¶
type ServerConf struct {
Http HttpConf `yaml:"http"`
}
Click to show internal directories.
Click to hide internal directories.