Categorygithub.com/mtfelian/utils
modulepackage
1.0.12
Repository: https://github.com/mtfelian/utils.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

AppendFile with given path.
BackupFileName returns a new name for inputFileName and backup extension, also checking the existence of other bak files with intention not to overwrite it when renaming to new name.
CallerFuncName returns name of a func which is a caller for func from which CallerFuncName was called.
CallerFuncNameString returns a string from CallerFuncName.
CallerFuncNameStringWithOffset returns a string from CallerFuncNameWithOffset.
CallerFuncNameWithOffset works like CallerFuncName but skips additional i stack frames.
CheckSnils проверяет СНИЛС на валидность путём вычисления его контрольной суммы.
CircularAdd возвращает следующий элемент кольцевой целочисленной арифметики начиная от a, макс.
CountElementsOnPage возвращает количество элементов на заданной странице page с размером pageSize если всего элементов elementsTotal.
CountPages возвращает количство страниц размера pageSize если всего элементов elementsTotal.
EncodeToWindows1251 перекодирует срез байт b из стандартной Go кодировки UTF-8 в кодировку Windows-1251.
FileExists returns true if a file with given path exists.
FileSize returns size of a file with given path, it returns 0 if file doesn't exists or on error.
FormatPhone форматирует строку с номером телефона в формат "71234567890" Возвращает: Успех: Форматированный номер телефона, nil Ошибка: Исходный номер телефона, ошибка.
GetFunctionName returns a name of function.
GetIPAddress пытается получить IP адрес из заголовков HTTP возвращает соотв-ю строку, или "0.0.0.0".
GetSelfPath returns a path to the caller executable.
IsDir returns true if the path specified is a directory.
IsEmptyDir returns true if the path specified is an empty directory.
IsInDocker returns whether execution is going inside a Docker container.
IsInGitlab returns true if we are in Gitlab.
IsInVexor returns whether execution is going inside Vexor CI.
IsNil returns true if obj is nil or contains empty value, otherwise returns false.
MarshalUnmarshalJSON marshals data to JSON and unmarshal it to out.
MustMarshalJSON works as json.Marshal, but panics on error.
MustMarshalUnmarshalJSON works like MarshalUnmarshalJSON but panic on error.
MustSelfPath returns path to this application executable, it panic at error.
NewFileUploadRequest creates a new file upload HTTP request with optional extra params.
NewIndicesSlice creates new slice for sorting with indices remembering.
NewIndicesUintSlice creates new slice of uint type for sorting with indices remembering.
PBool returns a pointer to bool value b.
PInt returns a pointer to int value i.
PString returns a pointer to string s.
PUint returns a pointer to uint value i.
RemoveDuplicates returns a slice with duplicates removed.
todo документация.
todo document it.
Round округляет значение val.
SliceContains checks for value of needle in slice haystack haystack's underlying type should be a slice, if not, the function panics.
SliceIntersects returns whether two slices intersects.
SortUints sorts a slice of uints in increasing order.
StringSliceSubstract substracts b from a, working with slices of strings.
StringToStringSlice converts a string values separated by sep to slice of string elements empty elements are ignored.
StringToUint interpretes string as a value of type uint.
StringToUintSlice converts a string values separated by sep to slice of uint elements It returns an error if any element can't be converted to uint If a converted element is less than min, it will not be added empty elements are ignored.
SubstringBetween returns a substring between substrs l and r from source string s.
ToLowerFirstRune returns string s with first rune converted to it's lowercase form.
Try tries n times to call an actionFunc() until conditionFunc() returns true actionFunc is a func returning error n is a number of times to try to call actionFunc() delay is a delay between calls actionFunc() conditionFunc is a func accepting error, if it returns true, Try will try again Try returns a number of attempts.
UintsAreSorted tests whether a slice of uints is sorted in increasing order.
UniqID creates a random string with length n.

# Variables

# Structs

FileUploadRequest это параметры для POST запроса с файлом.
IndicesSlice is a type for sorting with indexes remembering.

# Type aliases

StringSlice это срез строк реализует интерфейс Stringer.
UintSlice attaches the methods of sort.Interface to []uint, sorting in increasing order.