Documentation
¶
Index ¶
- Variables
- func BytesEqual(b, a byte, ignoreCase bool) bool
- func CleanHost(sUrl string) (string, error)
- func CompareArrays[T cmp.Ordered](a, b []T) bool
- func DoLocked(f func())
- func FuncFullname(f any) string
- func FuncFullnameColon(f any, fArg ...any) string
- func GenShaB64Hash(ab *string) (string, error)
- func GetWD() (string, error)
- func Iff[T any](b bool, tArg T, fArg T) T
- func InRange[T IInt](x, db, de T) bool
- func Inn[T IInnConstraint](b T, a *[]T, ignoreCase ...bool) bool
- func InnIdx[T IInnConstraint](b T, a *[]T, ignoreCase ...bool) (r int)
- func InsideWraped(err, wrapped error) bool
- func NilOrEmpty(s *string) bool
- func PathAbs(base string, path string) (string, error)
- func PathExists(path string) (bool, os.FileInfo, error)
- func SetTimer(ms int, afterFunc func())
- func StrEqual(s1, s2 string, ignoreCase bool) bool
- func StringContainsPart(s, substr string, iPartSize int) bool
- func WrapErr(f any, fArgs []any, err error, desc string) error
- type EIgnored
- type IInnConstraint
- type IInt
- type MapParam
- type TAnyArray
- type TAnyList
- type TStringList
- func (c *TStringList) Append(value string) *TStringList
- func (c *TStringList) HasValue(arg string) bool
- func (c *TStringList) Index(arg string) int
- func (c *TStringList) Insert(index int, value string) *TStringList
- func (c *TStringList) Remove(index int) *TStringList
- func (c *TStringList) String() (ret string)
- func (c *TStringList) Text(arg string) (ret string)
- func (c *TStringList) TrimStrings() *TStringList
- type WrError
Constants ¶
This section is empty.
Variables ¶
var CRLF string
OS independed line terminator
var ErrAny error = errors.New("test error")
ErrAny designated for InsideWraped(ErrAny, <any error, not nil>) to responce 'true'
var ErrBadArgument = errors.New("bad argument")
Functions ¶
func BytesEqual ¶
Check if 2 bytes are equal. Use ignoreCase = true to ignore case sensitivity.
func CompareArrays ¶
using: b := CompareArrays[uint8]([]uint8("123"), []uint8("456")). True means equal.
func FuncFullname ¶
Provide Unit file & Function name of the Function in format of "common.go^FuncFullnameDec:" Where "common.go" - name of implemented Function file. And "FuncFullnameDec" - name of the function itself in string
func FuncFullnameColon ¶
func GenShaB64Hash ¶
GenShaB64Hash generate Base64 of Sha512 hash. Max final length = 88 bytes.
func GetWD ¶
Get working directory (path to the binary file). Getwd() from the Standart Library provides current/active path, wich is not always path to the binary file.
func Inn ¶
func Inn[T IInnConstraint](b T, a *[]T, ignoreCase ...bool) bool
Using: xservice.Inn(byte('0'), []byte("1110")) Use ignoreCase = true to ignore case sensitivity.
func InnIdx ¶
func InnIdx[T IInnConstraint](b T, a *[]T, ignoreCase ...bool) (r int)
Using: xservice.InnIdx[byte](byte('0'), []byte("1110")) Returns the position of the first encounter of the element in the array or -1 if not found. Use ignoreCase = true to ignore case sensitivity.
func InsideWraped ¶
Check if error 'err' inside recursevely unwrapped error 'wrapped'. Use ErrAny to get 'true' in responce for any not nil error.
func NilOrEmpty ¶
NilOrEmpty returns true if argument is nil or empty.
func PathAbs ¶
PathAbs() returns an absolute representation of path wih base if any.
Otherwise it returns filepath.Abs().
If path already absolute, base would be ignored.
func StringContainsPart ¶
using: StringContainsPart("absolutely", "abso", 3) == true, as "abs" same as "bso" are parts of "absolutely". if iPartSize > len(substr) then iPartSize = len(substr)
func WrapErr ¶
WrapErr wraps the provided error, if it's not nil, with provided arguments and the description. Once the provided error is nil, but the description is provided, WrapErr makes the new error based on the description and the arguments. If both the error and the description are empty, WrapErr returns nil ignoring the presence of arguments.
Types ¶
type IInnConstraint ¶
type MapParam ¶
func MapParamStr ¶
Param string to map ------------------------------------------------------------- Example:
prm == "host=localhost port=5432 dbname=postgres" prmSeparator == " " keyValSeparator == "="
func (MapParam) Array ¶
Array:
map[string]string{"host": "localhost", "port": "5432", "dbname": "postgres"} -> []string{"host=localhost", "port=5432", "dbname=postgres"}
for that, keyValSeparator needs to = "=".
type TAnyList ¶
type TAnyList struct {
// contains filtered or unexported fields
}
func NewAnyList ¶
func (*TAnyList) ValueExists ¶
type TStringList ¶
type TStringList []string
TStringList------------------------------------------------------------- Obsolated - remove!
func NewStringList ¶
func NewStringList(arg string, trimEmptyStrings bool) (ret *TStringList)
func (*TStringList) Append ¶
func (c *TStringList) Append(value string) *TStringList
func (*TStringList) HasValue ¶
func (c *TStringList) HasValue(arg string) bool
func (*TStringList) Index ¶
func (c *TStringList) Index(arg string) int
func (*TStringList) Insert ¶
func (c *TStringList) Insert(index int, value string) *TStringList
func (*TStringList) Remove ¶
func (c *TStringList) Remove(index int) *TStringList
func (*TStringList) String ¶
func (c *TStringList) String() (ret string)
func (*TStringList) Text ¶
func (c *TStringList) Text(arg string) (ret string)
func (*TStringList) TrimStrings ¶
func (c *TStringList) TrimStrings() *TStringList