Documentation
¶
Index ¶
- func Array2DEquals(a [][]string, b [][]string) bool
- func ArrayEquals(a []string, b []string) bool
- func ArrayRemoveDuplicates(s *[]string)
- func ArrayToString(s []string) string
- func EscapeAssertion(s string) string
- func EscapeStringLiterals(expr string) string
- func GenerateConditionalGFunction(crm rbac.ConditionalRoleManager) govaluate.ExpressionFunction
- func GenerateGFunction(rm rbac.RoleManager, useCache bool) govaluate.ExpressionFunction
- func GetEvalValue(s string) []string
- func GlobMatch(key1 string, key2 string) (bool, error)
- func GlobMatchFunc(args ...interface{}) (interface{}, error)
- func HasEval(s string) bool
- func IPMatch(ip1 string, ip2 string) bool
- func IPMatchFunc(args ...interface{}) (interface{}, error)
- func JoinSlice(a string, b ...string) []string
- func JoinSliceAny(a string, b ...string) []interface{}
- func JsonToMap(jsonStr string) (map[string]interface{}, error)
- func KeyGet(key1, key2 string) string
- func KeyGet2(key1, key2 string, pathVar string) string
- func KeyGet2Func(args ...interface{}) (interface{}, error)
- func KeyGet3(key1, key2 string, pathVar string) string
- func KeyGet3Func(args ...interface{}) (interface{}, error)
- func KeyGetFunc(args ...interface{}) (interface{}, error)
- func KeyMatch(key1 string, key2 string) bool
- func KeyMatch2(key1 string, key2 string) bool
- func KeyMatch2Func(args ...interface{}) (interface{}, error)
- func KeyMatch3(key1 string, key2 string) bool
- func KeyMatch3Func(args ...interface{}) (interface{}, error)
- func KeyMatch4(key1 string, key2 string) bool
- func KeyMatch4Func(args ...interface{}) (interface{}, error)
- func KeyMatch5(key1 string, key2 string) bool
- func KeyMatch5Func(args ...interface{}) (interface{}, error)
- func KeyMatchFunc(args ...interface{}) (interface{}, error)
- func ParamsToString(s ...string) string
- func RegexMatch(key1 string, key2 string) bool
- func RegexMatchFunc(args ...interface{}) (interface{}, error)
- func RemoveComments(s string) string
- func RemoveDuplicateElement(s []string) []string
- func ReplaceEval(s string, rule string) string
- func ReplaceEvalWithMap(src string, sets map[string]string) string
- func Set2DEquals(a [][]string, b [][]string) bool
- func SetEquals(a []string, b []string) bool
- func SetEqualsInt(a []int, b []int) bool
- func SetSubtract(a []string, b []string) []string
- func SortArray2D(arr [][]string)
- func SortedArray2DEquals(a [][]string, b [][]string) bool
- func TimeMatch(startTime, endTime string) (bool, error)
- func TimeMatchFunc(args ...string) (bool, error)
- type LRUCache
- type SyncLRUCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Array2DEquals ¶
Array2DEquals determines whether two 2-dimensional string arrays are identical.
func ArrayEquals ¶
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 ¶
ArrayToString gets a printable string for a string array.
func EscapeAssertion ¶
EscapeAssertion escapes the dots in the assertion, because the expression evaluation doesn't support such variable names.
func EscapeStringLiterals ¶ added in v1.10.2
EscapeStringLiterals escapes backslashes in string literals within an expression to ensure consistent handling between govaluate (which interprets escape sequences) and CSV parsing (which treats backslashes as literal characters). This function doubles all backslashes within single-quoted and double-quoted strings.
func GenerateConditionalGFunction ¶ added in v1.10.0
func GenerateConditionalGFunction(crm rbac.ConditionalRoleManager) govaluate.ExpressionFunction
GenerateConditionalGFunction is the factory method of the g(_, _[, _]) function with conditions.
func GenerateGFunction ¶ added in v1.5.0
func GenerateGFunction(rm rbac.RoleManager, useCache bool) govaluate.ExpressionFunction
GenerateGFunction is the factory method of the g(_, _[, _]) function. If useCache is true, results are memoized per unique argument combination for performance. Set useCache to false when inputs are high-cardinality (e.g. UUIDs) to avoid unbounded memory growth.
func GetEvalValue ¶ added in v1.10.0
GetEvalValue returns the parameters of function eval.
func GlobMatch ¶ added in v1.10.0
GlobMatch determines whether key1 matches the pattern of key2 using glob pattern.
func GlobMatchFunc ¶ added in v1.10.0
func GlobMatchFunc(args ...interface{}) (interface{}, error)
GlobMatchFunc is the wrapper for GlobMatch.
func IPMatch ¶ added in v0.4.0
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 JoinSliceAny ¶ added in v1.10.0
JoinSliceAny joins a string and a slice into a new interface{} slice.
func KeyGet ¶ added in v1.10.0
KeyGet returns the matched part For example, "/foo/bar/foo" matches "/foo/*" "bar/foo" will been returned.
func KeyGet2 ¶ added in v1.10.0
KeyGet2 returns value matched pattern For example, "/resource1" matches "/:resource" if the pathVar == "resource", then "resource1" will be returned.
func KeyGet2Func ¶ added in v1.10.0
func KeyGet2Func(args ...interface{}) (interface{}, error)
KeyGet2Func is the wrapper for KeyGet2.
func KeyGet3 ¶ added in v1.10.0
KeyGet3 returns value matched pattern For example, "project/proj_project1_admin/" matches "project/proj_{project}_admin/" if the pathVar == "project", then "project1" will be returned.
func KeyGet3Func ¶ added in v1.10.0
func KeyGet3Func(args ...interface{}) (interface{}, error)
KeyGet3Func is the wrapper for KeyGet3.
func KeyGetFunc ¶ added in v1.10.0
func KeyGetFunc(args ...interface{}) (interface{}, error)
KeyGetFunc is the wrapper for KeyGet.
func KeyMatch ¶
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
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.1.0
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.1.0
func KeyMatch3Func(args ...interface{}) (interface{}, error)
KeyMatch3Func is the wrapper for KeyMatch3.
func KeyMatch4 ¶ added in v1.10.0
KeyMatch4 determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a *. Besides what KeyMatch3 does, KeyMatch4 can also match repeated patterns: "/parent/123/child/123" matches "/parent/{id}/child/{id}" "/parent/123/child/456" does not match "/parent/{id}/child/{id}" But KeyMatch3 will match both.
func KeyMatch4Func ¶ added in v1.10.0
func KeyMatch4Func(args ...interface{}) (interface{}, error)
KeyMatch4Func is the wrapper for KeyMatch4.
func KeyMatch5 ¶ added in v1.10.0
KeyMatch5 determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a * For example, - "/foo/bar?status=1&type=2" matches "/foo/bar" - "/parent/child1" and "/parent/child1" matches "/parent/*" - "/parent/child1?status=1" matches "/parent/*".
func KeyMatch5Func ¶ added in v1.10.0
func KeyMatch5Func(args ...interface{}) (interface{}, error)
KeyMatch5Func is the wrapper for KeyMatch5.
func KeyMatchFunc ¶
func KeyMatchFunc(args ...interface{}) (interface{}, error)
KeyMatchFunc is the wrapper for KeyMatch.
func ParamsToString ¶ added in v0.6.0
ParamsToString gets a printable string for variable number of parameters.
func RegexMatch ¶ added in v0.0.4
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
RemoveComments removes the comments starting with # in the text.
func RemoveDuplicateElement ¶ added in v1.10.0
func ReplaceEval ¶ added in v1.10.0
ReplaceEval replace function eval with the value of its parameters.
func ReplaceEvalWithMap ¶ added in v1.10.0
ReplaceEvalWithMap replace function eval with the value of its parameters via given sets.
func Set2DEquals ¶ added in v1.10.0
Set2DEquals determines whether two string slice sets are identical.
func SetEqualsInt ¶ added in v1.10.0
SetEquals determines whether two int sets are identical.
func SetSubtract ¶ added in v1.10.0
SetSubtract returns the elements in `a` that aren't in `b`.
func SortArray2D ¶ added in v1.10.0
func SortArray2D(arr [][]string)
SortArray2D Sorts the two-dimensional string array.
func SortedArray2DEquals ¶ added in v1.10.0
SortedArray2DEquals determines whether two 2-dimensional string arrays are identical.
func TimeMatch ¶ added in v1.10.0
TimeMatch determines whether the current time is between startTime and endTime. You can use "_" to indicate that the parameter is ignored.
func TimeMatchFunc ¶ added in v1.10.0
TimeMatchFunc is the wrapper for TimeMatch.
Types ¶
type LRUCache ¶ added in v1.10.0
type LRUCache struct {
// contains filtered or unexported fields
}
func NewLRUCache ¶ added in v1.10.0
type SyncLRUCache ¶ added in v1.10.0
type SyncLRUCache struct {
*LRUCache
// contains filtered or unexported fields
}
func NewSyncLRUCache ¶ added in v1.10.0
func NewSyncLRUCache(capacity int) *SyncLRUCache
func (*SyncLRUCache) Get ¶ added in v1.10.0
func (cache *SyncLRUCache) Get(key interface{}) (value interface{}, ok bool)
func (*SyncLRUCache) Put ¶ added in v1.10.0
func (cache *SyncLRUCache) Put(key interface{}, value interface{})