util

package
Version: v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2018 License: Apache-2.0 Imports: 6 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 GenerateGFunction added in v1.5.0

func GenerateGFunction(rm rbac.RoleManager) func(args ...interface{}) (interface{}, error)

GenerateGFunction is the factory method of the g(_, _) function.

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 KeyMatch3 added in v1.0.0

func KeyMatch3(key1 string, key2 string) bool

KeyMatch3 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 KeyMatch3Func added in v1.0.0

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

KeyMatch3Func is the wrapper for KeyMatch3.

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
t or T : Toggle theme light dark auto
y or Y : Canonical URL