utils

package
v0.0.0-...-9dfc967 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrDownloadFailed      = DictError("error on image download")
	ErrCloseReqBodyFailed  = DictError("error on closing a requests response")
	ErrPDFGenerationFailed = DictError("error during pds generation")
)
View Source
const (
	ErrClientCreation    = FileStorageErr("error on file storage client creation")
	ErrFileSave          = FileStorageErr("error on saving file to file storage")
	ErrFileRetrieval     = FileStorageErr("error on retrieving file from file storage")
	ErrFileLinkRetrieval = FileStorageErr("error on retrieving file link from file storage")
)
View Source
const ErrLogSetup = LogErr("error setting up logger")

Variables

This section is empty.

Functions

func DefaultErrorMessage

func DefaultErrorMessage(c *gin.Context, httpStatus int, details interface{})

Types

type BookDownloader

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

func NewBookDownloader

func NewBookDownloader(urlMaskFunc func(int) string) BookDownloader

func (*BookDownloader) CreatePDF

func (bd *BookDownloader) CreatePDF() (io.Reader, error)

type DictError

type DictError string

func (DictError) Error

func (e DictError) Error() string

type FileStorage

type FileStorage interface {
	Save(reader io.Reader, bucket, location string) error
	Get(bucket, location string) (io.Reader, error)
}

type FileStorageErr

type FileStorageErr string

func (FileStorageErr) Error

func (e FileStorageErr) Error() string

type LogErr

type LogErr string

func (LogErr) Error

func (e LogErr) Error() string

type MinioFileStorage

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

func NewMinioFileStorage

func NewMinioFileStorage(endpoint, accessKey, secretKey string, ssl bool) (MinioFileStorage, error)

func (*MinioFileStorage) Get

func (mfs *MinioFileStorage) Get(bucket, location string) (io.Reader, error)
func (mfs *MinioFileStorage) GetLink(filename, bucket, location string, expiry time.Duration) (*url.URL, error)

func (*MinioFileStorage) Save

func (mfs *MinioFileStorage) Save(reader io.Reader, bucket, location string) error

type MySQLConnector

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

func NewMySQLConnector

func NewMySQLConnector(address string, port int, dbName, user, password string) MySQLConnector

func (*MySQLConnector) Connect

func (msc *MySQLConnector) Connect() (*gorm.DB, error)

Jump to

Keyboard shortcuts

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