Documentation ¶
Index ¶
- Constants
- Variables
- func AsString(value interface{}) (string, bool)
- func DateOf(v time.Time) time.Time
- func EscapeRegex(v string) string
- func FindAllStringSubmatchMapWithRegexExpression(re RegexExpression, s string) []map[string]string
- func FindStringSubmatchMapWithRegexExpression(re RegexExpression, s string) map[string]string
- func GetField(object interface{}, fieldPath string) (interface{}, error)
- func InterfaceSliceToStringSlice(v []any) ([]string, bool)
- func IsStringSlice(arg any) ([]string, bool)
- func MatchWithRegexExpression(re RegexExpression, s string) bool
- func MaxTime(left, right time.Time) time.Time
- func MinDuration(left, right time.Duration) time.Duration
- func MinTime(left, right time.Time) time.Time
- func NewID() string
- func RandBase64String(n int) (string, error)
- func RandString(n int) string
- func ToObjectIDHex(s string) string
- func ToSnakeCase(str string) string
- func TruncateString(s string, chars int) string
- func Unique(s []string) []string
- type RegexExpression
- type WrapperBuiltInRegex
- type WrapperRegex2
Constants ¶
const ( Regexp2MatchTimeout = "REGEXP2_MATCH_TIMEOUT" DefaultRegex2MatchTimeout = time.Second )
const NamingCharacterSet = "abcdefghijklmnopqrstuvwxyz1234567890"
Variables ¶
var NumberOfCharacter = int64(len(NamingCharacterSet))
Functions ¶
func AsString ¶
AsString tries to convert an interface{} into a string, and returns its value and an integer indicating whether it succeeded or not.
func DateOf ¶
DateOf returns time without hour, minute, and second.
func FindAllStringSubmatchMapWithRegexExpression ¶
func FindAllStringSubmatchMapWithRegexExpression(re RegexExpression, s string) []map[string]string
FindAllStringSubmatchMapWithRegexExpression returns a slice of maps containing the values of the named subexpressions of all matches of the regular expression re in s. A return value of nil indicates no match.
func FindStringSubmatchMapWithRegexExpression ¶
func FindStringSubmatchMapWithRegexExpression(re RegexExpression, s string) map[string]string
FindStringSubmatchMapWithRegexExpression returns a map containing the values of the named subexpressions of the lefmost match of the regular expression re in s. A return value of nil indicates no match.
func GetField ¶
GetField returns the value of a field of an object or a map, given the field's name as a string. Multiple field names may be chained, separated by dots:
GetField(alarm_value, "State.Value")
An error is returned if the field does not exist. If the field is a pointer, it will be dereferenced before being returned. Note that GetField cannot return map keys that contain a dot.
func MatchWithRegexExpression ¶
func MatchWithRegexExpression(re RegexExpression, s string) bool
func MaxTime ¶
MaxTime returns max time between arguments.
func MinTime ¶
MinTime returns minimal time between arguments.
func RandBase64String ¶
RandBase64String generates a random base64 string by generated n bytes
func ToSnakeCase ¶
ToSnakeCase changes case of string to snake case.
Types ¶
type RegexExpression ¶
func NewRegexExpression ¶
func NewRegexExpression(expr string) (RegexExpression, error)
NewRegexExpression todo move to separate package