{"modulePath":"github.com/RedAFD/code-core","version":"v1.8.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package util\n\n## Constants\n\n```go\nconst (\n\t// OptionalBoolNone a \"null\" boolean value\n\tOptionalBoolNone = iota\n\t// OptionalBoolTrue a \"true\" boolean value\n\tOptionalBoolTrue\n\t// OptionalBoolFalse a \"false\" boolean value\n\tOptionalBoolFalse\n)\n```\n\n## Functions\n\n```go\nfunc EnsureAbsolutePath(path string, absoluteBase string) string\n```\nEnsureAbsolutePath ensure that a path is absolute, making it relative to absoluteBase if necessary\n\n```go\nfunc ExistsInSlice(target string, slice []string) bool\n```\nExistsInSlice returns true if string exists in slice.\n\n```go\nfunc IsEmptyString(s string) bool\n```\nIsEmptyString checks if the provided string is empty\n\n```go\nfunc IsEqualSlice(target []string, source []string) bool\n```\nIsEqualSlice returns true if slices are equal.\n\n```go\nfunc IsExternalURL(rawURL string) bool\n```\nIsExternalURL checks if rawURL points to an external URL like [http://example.com](http://example.com)\n\n```go\nfunc IsSliceInt64Eq(a, b []int64) bool\n```\nIsSliceInt64Eq returns if the two slice has the same elements but different sequences.\n\n```go\nfunc Max(a, b int) int\n```\nMax max of two ints\n\n```go\nfunc Min(a, b int) int\n```\nMin min of two ints\n\n```go\nfunc PathEscapeSegments(path string) string\n```\nPathEscapeSegments escapes segments of a path while not escaping forward slash\n\n```go\nfunc SanitizeMessage(message, unsanitizedURL string) string\n```\nSanitizeMessage sanitizes a message which may contains a sensitive URL\n\n```go\nfunc SanitizeURLCredentials(unsanitizedURL string, usePlaceholder bool) string\n```\nSanitizeURLCredentials sanitizes a url, either removing user credentials or replacing them with a placeholder.\n\n```go\nfunc URLJoin(base string, elems ...string) string\n```\nURLJoin joins url components, like path.Join, but preserving contents\n\n```go\nfunc URLSanitizedError(err error, unsanitizedURL string) error\n```\nURLSanitizedError returns the sanitized version an error whose message may contain a sensitive URL\n\n## Types\n\n```go\ntype Int64Slice []int64\n```\nInt64Slice attaches the methods of Interface to \\[]int64, sorting in increasing order.\n\n```go\nfunc (p Int64Slice) Len() int\n```\n\n```go\nfunc (p Int64Slice) Less(i, j int) bool\n```\n\n```go\nfunc (p Int64Slice) Swap(i, j int)\n```\n\n```go\ntype OptionalBool byte\n```\nOptionalBool a boolean that can be \"null\"\n\n```go\nfunc OptionalBoolOf(b bool) OptionalBool\n```\nOptionalBoolOf get the corresponding OptionalBool of a bool\n\n```go\nfunc (o OptionalBool) IsFalse() bool\n```\nIsFalse return true if equal to OptionalBoolFalse\n\n```go\nfunc (o OptionalBool) IsNone() bool\n```\nIsNone return true if equal to OptionalBoolNone\n\n```go\nfunc (o OptionalBool) IsTrue() bool\n```\nIsTrue return true if equal to OptionalBoolTrue\n\n```go\ntype TimeStamp int64\n```\nTimeStamp defines a timestamp\n\n```go\nfunc TimeStampNow() TimeStamp\n```\nTimeStampNow returns now int64\n\n```go\nfunc (ts TimeStamp) Add(seconds int64) TimeStamp\n```\nAdd adds seconds and return sum\n\n```go\nfunc (ts TimeStamp) AddDuration(interval time.Duration) TimeStamp\n```\nAddDuration adds time.Duration and return sum\n\n```go\nfunc (ts TimeStamp) AsTime() (tm time.Time)\n```\nAsTime convert timestamp as time.Time in Local locale\n\n```go\nfunc (ts TimeStamp) AsTimePtr() *time.Time\n```\nAsTimePtr convert timestamp as \\*time.Time in Local locale\n\n```go\nfunc (ts TimeStamp) Format(f string) string\n```\nFormat formats timestamp as\n\n```go\nfunc (ts TimeStamp) FormatLong() string\n```\nFormatLong formats as RFC1123Z\n\n```go\nfunc (ts TimeStamp) FormatShort() string\n```\nFormatShort formats as short\n\n```go\nfunc (ts TimeStamp) IsZero() bool\n```\nIsZero is zero time\n\n```go\nfunc (ts TimeStamp) Year() int\n```\nYear returns the time's year\n\n","path":"github.com/RedAFD/code-core/modules/util","name":"util","synopsis":"","isRedistributable":true}
