misc

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const IDNameLocaleDefaultLang = "default"
View Source
const OnPageDefault = 5

Variables

View Source
var (
	ErrNotFound       = errors.New("entity not found")
	ErrUserCtxExtract = errors.New("can not extract user context in schedule message handler")
	ErrAPIKey         = errors.New("incorrect api key")
	ErrZeroLen        = errors.New("zero len payload")
	ErrForbidden      = errors.New("forbidden")
	ErrMalformedData  = errors.New("malformed data")
	ErrUserNotSet     = errors.New("user not set")
	ErrArgSuccessExit = errors.New("arg success exit")
)

Functions

func DirNormalize

func DirNormalize(path string) (string, error)

DirNormalize normalizes the directory path

func MessageSplit

func MessageSplit(message string, chunkLimit int) []string

MessageSplit splits message to chunks each limited by chunkLimit

func MultiReaderCreate

func MultiReaderCreate(inReader io.Reader, outReadersCount int, errch chan error) []io.Reader

func PathNormalize

func PathNormalize(path string) (string, error)

PathNormalize normalizes the path

func TemplateExec

func TemplateExec(tpl string, d interface{}) (string, error)

TemplateExec makes message from given template `tpl` and data `d`

Types

type IDName

type IDName struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

func IDNamePaginate

func IDNamePaginate(elts []IDName, page, limit int64) (s []IDName, isBack, isNext bool)

type IDNameLocale added in v1.3.0

type IDNameLocale struct {
	ID   int64             `json:"id"`
	Name map[string]string `json:"name"`
}

func (*IDNameLocale) ValueGet added in v1.3.0

func (idn *IDNameLocale) ValueGet(lang string) *string

type MultiCloser

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

func NewMultiCloser

func NewMultiCloser(closers []io.Closer) *MultiCloser

func (*MultiCloser) Close

func (m *MultiCloser) Close() error

Jump to

Keyboard shortcuts

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