util

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EnableLog = true

EnableLog controls whether to print log to console.

Functions

func Array2DEquals

func Array2DEquals(a [][]string, b [][]string) bool

Array2DEquals determines whether two 2-dimensional string arrays are identical.

func ArrayEquals

func ArrayEquals(a []string, b []string) bool

ArrayEquals determines whether two string arrays are identical.

func ArrayRemoveDuplicates

func ArrayRemoveDuplicates(s *[]string)

ArrayRemoveDuplicates removes any duplicated elements in a string array.

func ArrayToString

func ArrayToString(s []string) string

ArrayToString gets a printable string for a string array.

func EscapeAssertion

func EscapeAssertion(s string) string

EscapeAssertion escapes the dots in the assertion, because the expression evaluation doesn't support such variable names.

func IPMatch added in v0.4.0

func IPMatch(ip1 string, ip2 string) bool

IPMatch determines whether IP address ip1 matches the pattern of IP address ip2, ip2 can be an IP address or a CIDR pattern. For example, "192.168.2.123" matches "192.168.2.0/24"

func IPMatchFunc added in v0.4.0

func IPMatchFunc(args ...interface{}) (interface{}, error)

IPMatchFunc is the wrapper for IPMatch.

func KeyMatch

func KeyMatch(key1 string, key2 string) bool

KeyMatch determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a *. For example, "/foo/bar" matches "/foo/*"

func KeyMatch2 added in v0.4.0

func KeyMatch2(key1 string, key2 string) bool

KeyMatch2 determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a *. For example, "/foo/bar" matches "/foo/*", "/resource1" matches "/:resource"

func KeyMatch2Func added in v0.4.0

func KeyMatch2Func(args ...interface{}) (interface{}, error)

KeyMatch2Func is the wrapper for KeyMatch2.

func KeyMatchFunc

func KeyMatchFunc(args ...interface{}) (interface{}, error)

KeyMatchFunc is the wrapper for KeyMatch.

func LogPrint added in v0.6.0

func LogPrint(v ...interface{})

LogPrint prints the log.

func LogPrintf added in v0.6.0

func LogPrintf(format string, v ...interface{})

LogPrintf prints the log with the format.

func ParamsToString added in v0.6.0

func ParamsToString(s ...string) string

ParamsToString gets a printable string for variable number of parameters.

func RegexMatch added in v0.0.4

func RegexMatch(key1 string, key2 string) bool

RegexMatch determines whether key1 matches the pattern of key2 in regular expression.

func RegexMatchFunc added in v0.0.4

func RegexMatchFunc(args ...interface{}) (interface{}, error)

RegexMatchFunc is the wrapper for RegexMatch.

func RemoveComments added in v0.1.0

func RemoveComments(s string) string

RemoveComments removes the comments starting with # in the text.

func SetEquals added in v0.0.4

func SetEquals(a []string, b []string) bool

SetEquals determines whether two string sets are identical.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL