collate

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompatibleCollate

func CompatibleCollate(collate1, collate2 string) bool

CompatibleCollate checks whether the two collate are the same.

func IsCICollation

func IsCICollation(collate string) bool

IsCICollation returns if the collation is case-sensitive

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

func GetCollator(collate string) Collator

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL