Versions in this module Expand all Collapse all v1 v1.1.5 Mar 31, 2025 Changes in this version + func AnyInArrayEquals(v []string, s string) bool v1.1.4 Mar 14, 2025 v1.1.3 Feb 28, 2025 Changes in this version + func MaskAndMarshal(obj interface{}) ([]byte, error) + func MaskFields(obj interface{}) v1.1.2 Feb 17, 2025 Changes in this version + const AnyAddress + const LocalAddress + const LocalIpv6Address v1.1.0 Jan 11, 2025 v1.0.0 Dec 16, 2024 Changes in this version + const B + const BYTE + const ContentTypeForm + const ContentTypeJson + const ContentTypeXml + const FieldsKey + const GB + const GIGABYTE + const KB + const KILOBYTE + const LOCAL_ADDRESS + const MB + const MEGABYTE + const MOVEFILE_REPLACE_EXISTING — windows/amd64 + const PB + const TB + const TERABYTE + const TagsKey + const TsLayout + const Verb_DELETE + const Verb_GET + const Verb_HEAD + const Verb_POST + const Verb_PUT + var ErrKeyNotFound = errors.New("key not found") + var NEWLINE = byte('\n') + var PrometheusMetricReplacer = strings.NewReplacer(".", "_", "-", "_") + var SPACE = byte(' ') + func AbsInt(x int) int + func AbsInt64(x int64) int64 + func AcquireTimer(timeout time.Duration) *time.Timer + func AddTags(ms MapStr, tags []string) error + func AddTagsWithKey(ms MapStr, key string, tags []string) error + func AesGcmDecrypt(hexEncodedBytes, secret, hexEncodedSalt []byte) ([]byte, error) + func AesGcmEncrypt(plaintext, secret []byte) ([]byte, []byte, error) + func AtomicFileRename(sourceFile, targetFile string) error + func AutoGetAddress(addr string) string + func ByteSize(bytes uint64) string + func BytesHasPrefix(data, prefix []byte) bool + func BytesHasSuffix(left, right []byte) bool + func BytesSearchValue(data, startTerm, endTerm, searchTrim []byte) bool + func BytesToInt(buf []byte) int + func BytesToInt64(buf []byte) int64 + func BytesToUint32(b []byte) (v uint32) + func BytesToUint64(b []byte) (v uint64) + func CheckIPBinding(ip string) (bool, error) + func CheckInstanceLock(p string) + func CheckProcessExists(pid int) bool + func ClearAllID() + func ClearInstanceLock() + func ClientIP(r *http.Request) string + func CompareInteger(x interface{}, y interface{}) bool + func CompareStringAndBytes(b []byte, s string) bool + func ContainStr(s, substr string) bool + func ContainTags(tag string, tags string) bool + func ContainsAnyInAnyIntArray(i interface{}, v []interface{}) bool + func ContainsAnyInArray(s string, v []string) bool + func ContainsInAnyInt32Array(i int, v []int) bool + func ContainsInAnyIntArray(i int64, v []int64) bool + func ConvertBytesFromString(formatedBytes string) (float64, error) + func ConvertStringToMap(str string, splitter string) (k, v string, err error) + func Copy(sourceStruct interface{}, pointToTarget interface{}) (err error) + func CopyFile(src, dst string) (w int64, err error) + func CreateCert(template, parent *x509.Certificate, pub interface{}, parentPriv interface{}) (cert *x509.Certificate, certPEM []byte, err error) + func CreateFile(dir string, name string) (string, error) + func DeepCopy(value interface{}) interface + func DiffTwoObject(a, b interface{}) (diff.Changelog, error) + func EncodeToBytes(key interface{}) ([]byte, error) + func EscapeNewLine(input []byte) []byte + func Expand(value map[string]interface{}) map[string]interface + func ExpandPrefixed(value map[string]interface{}, prefix string) map[string]interface + func ExpandPrefixedToResult(value map[string]interface{}, prefix string, result map[string]interface{}) + func ExtractBool(unk interface{}) (bool, error) + func ExtractFieldFromBytes(data *[]byte, start, end []byte, removedFromValue []byte) []byte + func ExtractFieldFromBytesWitSkipBytes(data *[]byte, start, toBeSkipedBytes, end []byte, removedFromValue []byte) []byte + func ExtractFieldFromJson(data *[]byte, fieldStartWith []byte, fieldEndWith []byte, ...) (bool, []byte) + func ExtractFieldFromJsonOrder(data *[]byte, fieldStartWith []byte, fieldEndWith []byte, ...) (bool, []byte) + func ExtractFloat(unk interface{}) (float64, error) + func ExtractInt(unk interface{}) (int64, error) + func ExtractString(unk interface{}) (string, error) + func FileAppendContentWithByte(file string, content []byte) (int, error) + func FileAppendNewLine(file string, content string) (int, error) + func FileAppendNewLineWithByte(file string, content []byte) (int, error) + func FileDelete(file string) error + func FileExists(path string) bool + func FileExtension(file string) string + func FileGetContent(file string) ([]byte, error) + func FileGetLines(filePath string) []string + func FileLinesWalk(filePath string, f func([]byte)) error + func FileMTime(file string) (int64, error) + func FilePutContent(file string, content string) (int, error) + func FilePutContentWithByte(file string, content []byte) (int, error) + func FileSize(file string) (int64, error) + func FilesExists(path ...string) bool + func FilterDirName(name string) bool + func FilterSpecialChar(keyword string) string + func Flatten(value interface{}, ignoreNil bool) map[string]interface + func FlattenJSON(value interface{}, ignoreNil bool) (m map[string]interface{}) + func FlattenJSONString(nestedstr, prefix string, ignoreNil bool) (string, error) + func FlattenPrefixed(value interface{}, prefix string, ignoreNil bool) map[string]interface + func FlattenPrefixedToResult(value interface{}, prefix string, m map[string]interface{}, ignoreNil bool) + func FlattenPrefixedToResultWithTagAsFieldName(value interface{}, prefix string, m map[string]interface{}, tag string, ...) + func FormatBytes(bytes float64, precision int) string + func FormatNumber(input float64) string + func FormatTime(date time.Time) string + func FormatTimeForFileName(date time.Time) string + func FormatTimeWithLocalTZ(date time.Time) string + func FormatTimeWithTZ(date time.Time) string + func FormatUnixTimestamp(unix int64) string + func FromJSONBytes(b []byte, v interface{}) (err error) + func FromJson(str string, to interface{}) error + func FromUnixTimestamp(unix int64) time.Time + func FromUnixTimestampInMicro(unix int64) time.Time + func FromUnixTimestampInMilli(unix int64) time.Time + func GenRsaKey() (prvkey, pubkey []byte) + func GenerateRandomString(cnum int) string + func GenerateServerCert(rootCert *x509.Certificate, rootKey *rsa.PrivateKey, rootCertPEM []byte, ...) (servCertPEM, servKeyPEM []byte, err error) + func GetAddress(adr string) *net.TCPAddr + func GetAvailablePort(ip string, port int) int + func GetBytes(key interface{}) []byte + func GetCertTemplate(dnsNames []string) (*x509.Certificate, error) + func GetCertTemplateWithSingleDomain(dnsNames string) (*x509.Certificate, error) + func GetClientCert(rootCert *x509.Certificate, rootKey any) (clientTLSCert tls.Certificate, clientCertPEM, clientKeyPEM []byte) + func GetDurationOrDefault(str string, defaultV time.Duration) time.Duration + func GetFieldAndTags(any interface{}, tags []string) []map[string]string + func GetFieldValueByTagName(any interface{}, tagName string, tagValue string) string + func GetHost(url string) string + func GetHostName() string + func GetIPPrefix(ip string) string + func GetIncrementID(bucket string) uint32 + func GetIncrementID64(bucket string) uint64 + func GetInt64Value(any interface{}) int64 + func GetIntMapKeys(m map[int]int) []int + func GetIntranetIP() (string, error) + func GetLocalIPs() []string + func GetLocalZone() string + func GetLowPrecisionCurrentTime() time.Time + func GetMapKeys(m map[string]KV) []string + func GetMapValueByKeys(keys []string, m map[string]interface{}) (interface{}, bool) + func GetPublishNetworkDeviceInfo(pattern string) (dev string, ip string, mask string, err error) + func GetRootCert() (rootCert *x509.Certificate, rootKey *rsa.PrivateKey, rootCertPEM []byte) + func GetRootUrl(source *uri.URL) string + func GetRuntimeErrorMessage(r runtime.Error) string + func GetSafetyInternalAddress(addr string) string + func GetSkipHostnameVerifyFunc(pool *x509.CertPool) func([][]byte, [][]*x509.Certificate) error + func GetSplitFunc(split []byte) func(data []byte, atEOF bool) (advance int, token []byte, err error) + func GetStringIntMapKeys(m map[string]int) []string + func GetSyncMapSize(m *sync.Map) int + func GetTypeAndPackageName(any interface{}, lowercase bool) (string, string) + func GetTypeName(any interface{}, lowercase bool) string + func GetUUID() string + func GetValidAddress(addr string) string + func GetValueByKeys(keys []string, m MapStr) (interface{}, bool) + func GzipCompress(a *[]byte, level int) []byte + func GzipDecompress(data *[]byte) ([]byte, error) + func HasSudoPermission() bool + func InsertBytesAfterField(data *[]byte, start, toBeSkipedBytes, end []byte, bytesToInsert []byte) []byte + func Int64ToBytes(i int64) []byte + func Int64ToString(num int64) string + func IntToBytes(n int) []byte + func IntToString(num int) string + func InterfaceToInt(y interface{}) int + func Invoke(any interface{}, name string, args ...interface{}) + func Ipv4MaskString(m []byte) string + func IsBytesEndingWith(data *[]byte, ending []byte) bool + func IsBytesEndingWithOrder(data *[]byte, ending []byte, reverse bool) bool + func IsExist(path string) bool + func IsFile(file string) bool + func IsFileWithinFolder(file, path string) bool + func IsLocalAddress(address []string, localIPs []string) bool + func IsPublicIP(IP net.IP) bool + func IsRootUser() bool + func IsValidEmail(email string) bool + func IsValidTLD(tld string) bool + func JoinArray(array []string, delimiter string) string + func JoinInterfaceArray(array []interface{}, delimiter string, valueFunc func(str string) string) string + func JoinMap(array map[string]interface{}, delimiter string) string + func JoinMapInt(array map[string]int, delimiter string) string + func JoinMapString(array map[string]string, delimiter string) string + func JoinPath(filenames ...string) string + func LimitedBytesSearch(data []byte, term []byte, limit int) bool + func ListAllFiles(path string) ([]string, error) + func MD5digest(str string) string + func MD5digestBytes(b []byte) [16]byte + func MD5digestString(b []byte) string + func MapLength(m *sync.Map) int + func MaxDuration(d1 time.Duration, d2 time.Duration) time.Duration + func MaxInt64(x int64, y int64) int64 + func MergeFields(ms, fields MapStr, underRoot bool) error + func MergeSpace(in string) (out string) + func MinDuration(d1 time.Duration, d2 time.Duration) time.Duration + func MinInt64(x int64, y int64) int64 + func Mod(data, max int) int + func ModString(data string, max int) int + func MustFromJSONBytes(b []byte, v interface{}) + func MustToJSON(v interface{}) string + func MustToJSONBytes(v interface{}) []byte + func NearestThousandFormat(num float64) string + func NoWordBreak(in string) string + func NumberFormat(number float64, decimals int, decPoint, thousandsSep string) string + func ParseDuration(s string) (time.Duration, error) + func ParsePrivateKey(der []byte) (any, error) + func ParseStandardTime(value string) (time.Time, error) + func ParseTime(str string) time.Time + func PickRandomCnLegendName() string + func PickRandomCnName() string + func PickRandomName() string + func PickRandomNameByDict(str string) string + func PickRandomNumber(seed int) int + func PidExists(pid int32) (bool, error) + func Post(url string, values url.Values) []byte + func PrefixAnyInArray(s string, v []string) bool + func PrefixStr(s, substr string) bool + func PrintStringByteLines(array [][]byte) string + func ProcessJsonData(data *[]byte, blockSplit []byte, limitBlockSize int, ...) bool + func PromptYesNo(prompt string, defaultAnswer bool) bool + func RandomBytes(length int) ([]byte, error) + func ReadInput() (string, error) + func RegexPatternMatch(pattern, value string) bool + func ReleaseTimer(t *time.Timer) + func RemoveSpaces(str string) string + func Rename(file string, to string) error + func ReplaceByte(str []byte, old, new []byte) []byte + func RestorePersistID(path string) + func Round(num float64) int + func RoundInt(input float64) int + func RoundPrec(x float64, prec int) float64 + func RsaDecrypt(ciphertext, keyBytes []byte) []byte + func RsaEncrypt(data, keyBytes []byte) []byte + func RsaSignWithSha256(data []byte, keyBytes []byte) []byte + func RsaVerySignWithSha256(data, signData, keyBytes []byte) bool + func SetupTimeNowRefresh() + func Sha1Hash(str string) string + func Since(t1 time.Time) time.Duration + func SnapshotPersistID() + func StringArrayIntersection(arr1 []string, arr2 []string) []string + func StringDefault(val, defaultV string) string + func StringInArray(s []string, element string) bool + func StringToFloat(s string) (float64, error) + func StringToUTF16(s string) []uint16 + func StripCtlAndExtFromBytes(str string) string + func StripCtlAndExtFromUTF8(str string) string + func StripCtlAndExtFromUnicode(str string) string + func StripCtlFromBytes(str string) string + func StripCtlFromUTF8(str string) string + func SubString(str string, begin, length int) (substr string) + func SubStringWithSuffix(str string, length int, suffix string) string + func SuffixAnyInArray(s string, v []string) bool + func SuffixStr(s, substr string) bool + func TestListenOnTCPPort(ip string, port int) bool + func TestPort(port int) bool + func TestTCPAddress(host string, timeout time.Duration) bool + func TestTCPPort(host string, port int, duration time.Duration) bool + func ToBytes(s string) (uint64, error) + func ToFixed(num float64, precision int) float64 + func ToFloat(s string, defaultValue float64) float64 + func ToInt(str string) (int, error) + func ToInt64(str string) (int64, error) + func ToJSONBytes(v interface{}) ([]byte, error) + func ToJson(in interface{}, indent bool) string + func ToLowercase(str []byte) []byte + func ToMegabytes(s string) (uint64, error) + func ToString(obj interface{}) string + func ToUppercase(str []byte) []byte + func TrimLeftStr(str string, left string) string + func TrimRightStr(str string, right string) string + func TrimSpaces(str string) string + func TryGetFileAbsPath(filePath string, ignoreMissing bool) string + func TypeIsArray(any interface{}) bool + func TypeIsMap(any interface{}) bool + func Uint32toBytes(b []byte, v uint32) + func Uint64toBytes(b []byte, v uint64) + func UnicodeIndex(str, substr string) int + func UnifyLocalAddress(host string) string + func UnsafeBytesToString(bs []byte) string + func UnsafeStringToBytes(s string) []byte + func UrlDecode(str string) string + func UrlEncode(str string) string + func VersionCompare(v1, v2 string) (int, error) + func WaitServerUp(addr string, duration time.Duration) error + func WalkBytesAndReplace(data []byte, find, replace byte) + func XSSHandle(src string) string + func XXHash(data string) uint32 + type Annotation struct + Annotation []Annotation + Field string + Tag string + Type string + func GetTagsByTagName(any interface{}, tagName string) []Annotation + type AtomicID struct + MaxSequence uint32 + MaxSequence64 uint64 + Sequence uint32 + Sequence64 uint64 + func GetAutoIncrement32ID(bucket string, rangeFrom, rangeTo uint32) *AtomicID + func GetAutoIncrement64ID(bucket string, rangeFrom, rangeTo uint64) *AtomicID + func (id *AtomicID) Increment() uint32 + func (id *AtomicID) Increment64() uint64 + type ByteValue struct + Size float64 + func (this ByteValue) String() string + type Cache struct + func NewCache(d time.Duration, initialSize int) *Cache + func NewCacheWithExpireOnAdd(d time.Duration, initialSize int) *Cache + func NewCacheWithRemovalListener(d time.Duration, initialSize int, l RemovalListener) *Cache + func (c *Cache) CleanUp() int + func (c *Cache) Delete(k Key) Value + func (c *Cache) Entries() map[Key]Value + func (c *Cache) Get(k Key) Value + func (c *Cache) Put(k Key, v Value) Value + func (c *Cache) PutIfAbsent(k Key, v Value) Value + func (c *Cache) PutIfAbsentWithTimeout(k Key, v Value, timeout time.Duration) Value + func (c *Cache) PutWithTimeout(k Key, v Value, timeout time.Duration) Value + func (c *Cache) Replace(k Key, v Value) Value + func (c *Cache) ReplaceWithTimeout(k Key, v Value, timeout time.Duration) Value + func (c *Cache) Size() int + func (c *Cache) StartJanitor(interval time.Duration) + func (c *Cache) StopJanitor() + type Diff struct + Diff string + Status DiffStatus + Yaml1Struct *RawYaml + Yaml2Struct *RawYaml + type DiffStatus int + const DiffStatus1Missing + const DiffStatus2Missing + const DiffStatusExists + const DiffStatusSame + type Diffs []*Diff + func Do(list1 RawYamlList, list2 RawYamlList) Diffs + type EventMetadata struct + Fields MapStr + FieldsUnderRoot bool + Tags []string + type KV struct + Key string + Value string + type Key interface + type KeyValue struct + Key string + Payload interface{} + Value int64 + func SortKeyValueArray(keyValuePairs []KeyValue, revers bool) []KeyValue + func SortMapStrIntToKV(data map[string]int) []KeyValue + type MapStr map[string]interface + func (m *MapStr) Merge(vars map[string]interface{}) + func (m MapStr) Clone() MapStr + func (m MapStr) CopyFieldsTo(to MapStr, key string) error + func (m MapStr) DeepUpdate(d MapStr) + func (m MapStr) Delete(key string) error + func (m MapStr) Equals(dst MapStr) bool + func (m MapStr) Flatten() MapStr + func (m MapStr) GetValue(key string) (interface{}, error) + func (m MapStr) HasKey(key string) (bool, error) + func (m MapStr) Put(key string, value interface{}) (interface{}, error) + func (m MapStr) SafetyHasKey(key string) bool + func (m MapStr) String() string + func (m MapStr) StringToPrint() string + func (m MapStr) Update(d MapStr) + func MapStrUnion(dict1 MapStr, dict2 MapStr) MapStr + type MapStrPointer struct + func NewMapStrPointer(m MapStr) MapStrPointer + func (m *MapStrPointer) Set(p MapStr) + func (m MapStrPointer) Get() MapStr + type RawYaml struct + Raw interface{} + type RawYamlList []*RawYaml + type RemovalListener func(k Key, v Value) + type Request struct + Agent string + Body []byte + Compress bool + ContentType string + Context context.Context + Cookie string + Method string + Path string + Proxy string + Url string + func NewDeleteRequest(url string, body []byte) *Request + func NewGetRequest(url string, body []byte) *Request + func NewPostRequest(url string, body []byte) *Request + func NewPutRequest(url string, body []byte) *Request + func NewRequest(method, url string) *Request + func (r *Request) AcceptGzip() *Request + func (r *Request) AddHeader(key, v string) *Request + func (r *Request) SetAgent(agent string) *Request + func (r *Request) SetBasicAuth(username, password string) *Request + func (r *Request) SetContentType(contentType string) *Request + func (r *Request) SetProxy(proxy string) *Request + type Result struct + Body []byte + Headers map[string][]string + Host string + Size uint64 + StatusCode int + Url string + func ExecuteRequest(req *Request) (result *Result, err error) + func ExecuteRequestWithCatchFlag(client *http.Client, req *Request, catchError bool) (result *Result, err error) + func HttpDelete(resource string) (*Result, error) + func HttpGet(resource string) (*Result, error) + func HttpGetWithCookie(resource string, cookie string, proxy string) (*Result, error) + type SQLQueryString struct + func NewSQLQueryString(query string) *SQLQueryString + func (p SQLQueryString) AfterAll(word string) (atAfters []string) + func (p SQLQueryString) TableNames() (names []string, err error) + type StringSet map[string]struct + func MakeStringSet(strings ...string) StringSet + func (set StringSet) Add(s string) + func (set StringSet) Count() int + func (set StringSet) Del(s string) + func (set StringSet) Has(s string) (exists bool) + type Time time.Time + func MustParseTime(value string) Time + func ParseTimeWithStandardSpec(value string) (Time, error) + func (t *Time) UnmarshalJSON(data []byte) (err error) + func (t Time) Hash32(h hash.Hash32) error + func (t Time) MarshalJSON() ([]byte, error) + func (t Time) String() string + type Value interface + type Version struct + func MustParseGeneric(str string) *Version + func MustParseSemantic(str string) *Version + func ParseGeneric(str string) (*Version, error) + func ParseSemantic(str string) (*Version, error) + func (v *Version) AtLeast(min *Version) bool + func (v *Version) BuildMetadata() string + func (v *Version) Compare(other string) (int, error) + func (v *Version) Components() []uint + func (v *Version) LessThan(other *Version) bool + func (v *Version) Major() uint + func (v *Version) Minor() uint + func (v *Version) Patch() uint + func (v *Version) PreRelease() string + func (v *Version) String() string + func (v *Version) WithBuildMetadata(buildMetadata string) *Version + func (v *Version) WithMajor(major uint) *Version + func (v *Version) WithMinor(minor uint) *Version + func (v *Version) WithPatch(patch uint) *Version + func (v *Version) WithPreRelease(preRelease string) *Version