Documentation ¶
Index ¶
- Constants
- func EnsureAbsolutePath(path string, absoluteBase string) string
- func ExistsInSlice(target string, slice []string) bool
- func IsEmptyString(s string) bool
- func IsEqualSlice(target []string, source []string) bool
- func IsExternalURL(rawURL string) bool
- func IsSliceInt64Eq(a, b []int64) bool
- func Max(a, b int) int
- func Min(a, b int) int
- func RemoveAll(path string) error
- func SanitizeMessage(message, unsanitizedURL string) string
- func SanitizeURLCredentials(unsanitizedURL string, usePlaceholder bool) string
- func URLJoin(base string, elems ...string) string
- func URLSanitizedError(err error, unsanitizedURL string) error
- type Int64Slice
- type OptionalBool
- type TimeStamp
- func (ts TimeStamp) Add(seconds int64) TimeStamp
- func (ts TimeStamp) AddDuration(interval time.Duration) TimeStamp
- func (ts TimeStamp) AsTime() (tm time.Time)
- func (ts TimeStamp) AsTimePtr() *time.Time
- func (ts TimeStamp) Format(f string) string
- func (ts TimeStamp) FormatLong() string
- func (ts TimeStamp) FormatShort() string
- func (ts TimeStamp) IsZero() bool
- func (ts TimeStamp) Year() int
Constants ¶
const ( // OptionalBoolNone a "null" boolean value OptionalBoolNone = iota // OptionalBoolTrue a "true" boolean value OptionalBoolTrue // OptionalBoolFalse a "false" boolean value OptionalBoolFalse )
Variables ¶
This section is empty.
Functions ¶
func EnsureAbsolutePath ¶ added in v1.3.0
EnsureAbsolutePath ensure that a path is absolute, making it relative to absoluteBase if necessary
func ExistsInSlice ¶ added in v1.5.0
ExistsInSlice returns true if string exists in slice.
func IsEmptyString ¶ added in v1.7.0
IsEmptyString checks if the provided string is empty
func IsEqualSlice ¶ added in v1.5.0
IsEqualSlice returns true if slices are equal.
func IsExternalURL ¶ added in v1.4.3
IsExternalURL checks if rawURL points to an external URL like http://example.com
func IsSliceInt64Eq ¶ added in v1.3.0
IsSliceInt64Eq returns if the two slice has the same elements but different sequences.
func SanitizeMessage ¶ added in v1.3.1
SanitizeMessage sanitizes a message which may contains a sensitive URL
func SanitizeURLCredentials ¶ added in v1.3.1
SanitizeURLCredentials sanitizes a url, either removing user credentials or replacing them with a placeholder.
func URLJoin ¶ added in v1.4.3
URLJoin joins url components, like path.Join, but preserving contents
func URLSanitizedError ¶ added in v1.3.1
URLSanitizedError returns the sanitized version an error whose message may contain a sensitive URL
Types ¶
type Int64Slice ¶ added in v1.3.0
type Int64Slice []int64
Int64Slice attaches the methods of Interface to []int64, sorting in increasing order.
func (Int64Slice) Len ¶ added in v1.3.0
func (p Int64Slice) Len() int
func (Int64Slice) Less ¶ added in v1.3.0
func (p Int64Slice) Less(i, j int) bool
func (Int64Slice) Swap ¶ added in v1.3.0
func (p Int64Slice) Swap(i, j int)
type OptionalBool ¶
type OptionalBool byte
OptionalBool a boolean that can be "null"
func OptionalBoolOf ¶
func OptionalBoolOf(b bool) OptionalBool
OptionalBoolOf get the corresponding OptionalBool of a bool
func (OptionalBool) IsFalse ¶ added in v1.3.0
func (o OptionalBool) IsFalse() bool
IsFalse return true if equal to OptionalBoolFalse
func (OptionalBool) IsNone ¶ added in v1.3.0
func (o OptionalBool) IsNone() bool
IsNone return true if equal to OptionalBoolNone
func (OptionalBool) IsTrue ¶ added in v1.3.0
func (o OptionalBool) IsTrue() bool
IsTrue return true if equal to OptionalBoolTrue
type TimeStamp ¶ added in v1.4.0
type TimeStamp int64
TimeStamp defines a timestamp
func (TimeStamp) AddDuration ¶ added in v1.4.0
AddDuration adds time.Duration and return sum
func (TimeStamp) AsTimePtr ¶ added in v1.4.0
AsTimePtr convert timestamp as *time.Time in Local locale
func (TimeStamp) FormatLong ¶ added in v1.4.0
FormatLong formats as RFC1123Z
func (TimeStamp) FormatShort ¶ added in v1.4.0
FormatShort formats as short