Documentation
¶
Index ¶
Constants ¶
const (
// DefaultLen is set for datum if the string datum don't know its length.
DefaultLen = 0
)
Variables ¶
This section is empty.
Functions ¶
func CollationName2ID ¶
CollationName2ID return the collation id by the given name. If the name is not found in the map, the default collation id is returned
func CompatibleCollate ¶
CompatibleCollate checks whether the two collate are the same.
func GetCollationByName ¶
GetCollationByName wraps charset.GetCollationByName, it checks the collation.
func IsCICollation ¶
IsCICollation returns if the collation is case-sensitive
func NewCollationEnabled ¶
func NewCollationEnabled() bool
NewCollationEnabled returns if the new collations are enabled.
Types ¶
type Collator ¶
type Collator interface { // Compare returns an integer comparing the two strings. The result will be 0 if a == b, -1 if a < b, and +1 if a > b. Compare(a, b string) int // Key returns the collate key for str. If the collation is padding, make sure the PadLen >= len(rune[]str) in opt. Key(str string) []byte // Pattern get a collation-aware WildcardPattern. Pattern() WildcardPattern }
Collator provides functionality for comparing strings for a given collation order.
func GetCollator ¶
GetCollator get the collator according to collate, it will return the binary collator if the corresponding collator doesn't exist.
type WildcardPattern ¶
type WildcardPattern interface { // Compile compiles the patternStr with specified escape character. Compile(patternStr string, escape byte) // DoMatch tries to match the str with compiled pattern, `Compile()` must be called before calling it. DoMatch(str string) bool }
WildcardPattern is the interface used for wildcard pattern match.