Documentation ¶
Index ¶
- func ByteSize(b any) string
- func GetBytes(s string) []byte
- func GetFieldValue(key string, exprs string, defaultValue ...interface{}) (r any)
- func GetString(b []byte) string
- func ImmutableString(s string) string
- func SafeBytes(b []byte) []byte
- func SafeString(s string) string
- func UnsafeBytes(s string) (bs []byte)
- func UnsafeString(b []byte) string
- type Kind
- type Pattern
- type Tokenize
- func (p Tokenize) IndexWildcard() int
- func (p Tokenize) IsValid() bool
- func (p Tokenize) Matches(s string) bool
- func (p Tokenize) ReplaceTag(tag string, value string) Tokenize
- func (p Tokenize) ReplaceTags(m map[string]string) Tokenize
- func (p Tokenize) Trim(s string) Tokenize
- func (p Tokenize) Values(s string) (map[string]string, bool)
- type Type
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFieldValue ¶
func ImmutableString ¶
ImmutableString copies a string to make it immutable
func UnsafeBytes ¶
#nosec G103 GetBytes returns a byte pointer without allocation
func UnsafeString ¶
#nosec G103 GetString returns a string pointer without allocation
Types ¶
type Pattern ¶
type Pattern string
Pattern is a resource pattern that may contain wildcards and tags.
Pattern("example.resource.>") // Full wild card (>) matches anything that follows Pattern("example.item.*") // Wild card (*) matches a single part Pattern("example.model.$id") // Tag (starting with $) matches a single part
func (Pattern) IndexWildcard ¶
IndexWildcard returns the index of the first instance of a wild card (*, >, or $tag) in pattern, or -1 if no wildcard is present.
Behavior is undefined for an invalid pattern.
func (Pattern) Matches ¶
Matches tests if the resource name, s, matches the pattern.
The resource name might in itself contain wild cards and tags.
Behavior is undefined for an invalid pattern or an invalid resource name.
func (Pattern) ReplaceTag ¶
ReplaceTag searches for a given tag (without $) and replaces it with the value.
Behavior is undefined for an invalid pattern.
func (Pattern) ReplaceTags ¶
ReplaceTags searches for tags and replaces them with the map value for the key matching the tag (without $).
Behavior is undefined for an invalid pattern.
type Tokenize ¶
type Tokenize string
Tokenize is a resource Tokenize that may contain wildcards and tags.
Tokenize("example.resource.>") // Full wild card (>) matches anything that follows Tokenize("example.item.*") // Wild card (*) matches a single part Tokenize("example.model.$id") // Tag (starting with $) matches a single part
func (Tokenize) IndexWildcard ¶
IndexWildcard returns the index of the first instance of a wild card (*, >, or $tag) in Tokenize, or -1 if no wildcard is present.
Behavior is undefined for an invalid Tokenize.
func (Tokenize) Matches ¶
Matches tests if the resource name, s, matches the Tokenize.
The resource name might in itself contain wild cards and tags.
Behavior is undefined for an invalid Tokenize or an invalid resource name.
func (Tokenize) ReplaceTag ¶
ReplaceTag searches for a given tag (without $) and replaces it with the value.
Behavior is undefined for an invalid Tokenize.
func (Tokenize) ReplaceTags ¶
ReplaceTags searches for tags and replaces them with the map value for the key matching the tag (without $).
Behavior is undefined for an invalid Tokenize.