Documentation
¶
Index ¶
- func NewMySQLGormDb(config *MySQLConfig) (e *gorm.DB, err error)
- func NewPostgresGormDb(config *PostgresConfig) (e *gorm.DB, err error)
- func NewPostgresGormDbWithDSN(dsn string) (e *gorm.DB, err error)
- type Minio
- func (m *Minio) GetFileBytes(objectName string, opts minio.GetObjectOptions) ([]byte, error)
- func (m *Minio) GetFileReader(objectName string, opts minio.GetObjectOptions) (io.Reader, error)
- func (m *Minio) GetFileUrl(objectName string, timeOut *time.Duration) string
- func (m *Minio) NewClient(log *xlog.Logger) error
- func (m *Minio) UploadFile(objectName string, fileReader *os.File, opts minio.PutObjectOptions) error
- func (m *Minio) UploadFileByBuffer(objectName string, buf *bytes.Buffer, opts minio.PutObjectOptions) error
- func (m *Minio) UploadFileByBytes(objectName string, fileBytes []byte, opts minio.PutObjectOptions) error
- func (m *Minio) UploadFileByPath(objectName, filePath string, opts minio.PutObjectOptions) error
- type MinioConfig
- type MySQLConfig
- type PostgresConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMySQLGormDb ¶
func NewMySQLGormDb(config *MySQLConfig) (e *gorm.DB, err error)
NewMySQLGormDb 创建MySQL客户端
func NewPostgresGormDb ¶
func NewPostgresGormDb(config *PostgresConfig) (e *gorm.DB, err error)
Types ¶
type Minio ¶
type Minio struct {
Conf MinioConfig
Client *minio.Client
// contains filtered or unexported fields
}
func (*Minio) GetFileBytes ¶
GetFileBytes 获取文件字节流
func (*Minio) GetFileReader ¶
GetFileReader 获取文件流
func (*Minio) GetFileUrl ¶
func (*Minio) UploadFile ¶
func (m *Minio) UploadFile(objectName string, fileReader *os.File, opts minio.PutObjectOptions) error
UploadFile 根据文件流上传文件
func (*Minio) UploadFileByBuffer ¶
func (m *Minio) UploadFileByBuffer(objectName string, buf *bytes.Buffer, opts minio.PutObjectOptions) error
UploadFileByBuffer 根据文件缓冲区上传文件
func (*Minio) UploadFileByBytes ¶
func (m *Minio) UploadFileByBytes(objectName string, fileBytes []byte, opts minio.PutObjectOptions) error
UploadFileByBytes 根据文件字节流上传文件
func (*Minio) UploadFileByPath ¶
func (m *Minio) UploadFileByPath(objectName, filePath string, opts minio.PutObjectOptions) error
UploadFileByPath 根据文件完整路径上传文件
type MinioConfig ¶
type MySQLConfig ¶
type MySQLConfig struct {
Path string `yaml:"path"`
Username string `yaml:"username"`
Password string `yaml:"password"`
Database string `yaml:"database"`
Config string `yaml:"config"`
MaxIdleConns int `yaml:"max_idle_conns"`
MaxOpenConns int `yaml:"max_open_conns"`
ConnMaxLifetime int `yaml:"conn_max_lifetime"`
IsConsole bool `yaml:"is_console"`
}
MySQLConfig MySQL配置
type PostgresConfig ¶
Click to show internal directories.
Click to hide internal directories.