Documentation ¶
Overview ¶
Package pattern handles parsing and matching SQL LIKE-style glob patterns.
This file was auto-generated by the vanadium vdl tool. Package: pattern
Index ¶
- Constants
- Variables
- func ErrorfIllegalEscapeChar(ctx *context.T, format string) error
- func ErrorfInvalidEscape(ctx *context.T, format string, escaped string) error
- func Escape(s string) string
- func EscapeWithEscapeChar(s string, escChar rune) string
- func MessageIllegalEscapeChar(ctx *context.T, message string) error
- func MessageInvalidEscape(ctx *context.T, message string, escaped string) error
- func ParamsErrIllegalEscapeChar(argumentError error) (verrorComponent string, verrorOperation string, returnErr error)
- func ParamsErrInvalidEscape(argumentError error) (verrorComponent string, verrorOperation string, escaped string, ...)
- type Pattern
Constants ¶
const (
// DefaultEscapeChar is the default escape character sequence.
DefaultEscapeChar = '\\'
)
Variables ¶
var ( ErrIllegalEscapeChar = verror.NewIDAction("v.io/v23/query/pattern.IllegalEscapeChar", verror.NoRetry) ErrInvalidEscape = verror.NewIDAction("v.io/v23/query/pattern.InvalidEscape", verror.NoRetry) )
Functions ¶
func ErrorfIllegalEscapeChar ¶ added in v0.1.10
ErrorfIllegalEscapeChar calls ErrIllegalEscapeChar.Errorf with the supplied arguments.
func ErrorfInvalidEscape ¶ added in v0.1.10
ErrorfInvalidEscape calls ErrInvalidEscape.Errorf with the supplied arguments.
func Escape ¶
Escape escapes a literal string for inclusion in a LIKE-style pattern assuming '\' as escape character. See EscapeWithEscapeChar().
func EscapeWithEscapeChar ¶
EscapeWithEscapeChar escapes a literal string for inclusion in a LIKE-style pattern. It inserts escChar before each '_', '%', and escChar in the string.
func MessageIllegalEscapeChar ¶ added in v0.1.10
MessageIllegalEscapeChar calls ErrIllegalEscapeChar.Message with the supplied arguments.
func MessageInvalidEscape ¶ added in v0.1.10
MessageInvalidEscape calls ErrInvalidEscape.Message with the supplied arguments.
Types ¶
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
Pattern is a parsed LIKE-style glob pattern.
func Parse ¶
Parse parses a LIKE-style glob pattern assuming '\' as escape character. See ParseWithEscapeChar().
func ParseWithEscapeChar ¶
ParseWithEscapeChar parses a LIKE-style glob pattern. Supported wildcards are '_' (match any one character) and '%' (match zero or more characters). They can be escaped by escChar; escChar can also escape itself. '_' and '%' cannot be used as escChar; '\x00' escChar disables escaping.
func (*Pattern) FixedPrefix ¶
FixedPrefix returns the unescaped fixed prefix that all matching strings must start with, and whether the prefix is the whole pattern.
func (*Pattern) MatchString ¶
MatchString returns true iff the pattern matches the entire string.