Documentation ¶
Index ¶
Constants ¶
const (
Ignore = ceType4
)
For normal collation elements, we assume that a collation element either has a primary or non-default secondary value, not both. Collation elements with a primary value are of the form 01pppppp pppppppp ppppppp0 ssssssss
- p* is primary collation value
- s* is the secondary collation value
00pppppp pppppppp ppppppps sssttttt, where
- p* is primary collation value
- s* offset of secondary from default value.
- t* is the tertiary collation value
100ttttt cccccccc pppppppp pppppppp
- t* is the tertiar collation value
- c* is the cannonical combining class
- p* is the primary collation value
Collation elements with a secondary value are of the form 1010cccc ccccssss ssssssss tttttttt, where
- c* is the canonical combining class
- s* is the secondary collation value
- t* is the tertiary collation value
11qqqqqq qqqqqqqq qqqqqqq0 00000000
- q* quaternary value
const (
Ignore = ceType4
)
For normal collation elements, we assume that a collation element either has a primary or non-default secondary value, not both. Collation elements with a primary value are of the form 01pppppp pppppppp ppppppp0 ssssssss
- p* is primary collation value
- s* is the secondary collation value
00pppppp pppppppp ppppppps sssttttt, where
- p* is primary collation value
- s* offset of secondary from default value.
- t* is the tertiary collation value
100ttttt cccccccc pppppppp pppppppp
- t* is the tertiar collation value
- c* is the cannonical combining class
- p* is the primary collation value
Collation elements with a secondary value are of the form 1010cccc ccccssss ssssssss tttttttt, where
- c* is the canonical combining class
- s* is the secondary collation value
- t* is the tertiary collation value
11qqqqqq qqqqqqqq qqqqqqq0 00000000
- q* quaternary value
const (
MaxQuaternary = 0x1FFFFF // 21 bits.
)
const (
MaxQuaternary = 0x1FFFFF // 21 bits.
)
const (
PrivateUse = minContract
)
const (
PrivateUse = minContract
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Elem ¶
type Elem uint32
Elem is a representation of a collation element. This API provides ways to encode and decode Elems. Implementations of collation tables may use values greater or equal to PrivateUse for their own purposes. However, these should never be returned by AppendNext.
func MakeElem ¶
MakeElem returns an Elem for the given values. It will return an error if the given combination of values is invalid.
func MakeQuaternary ¶
MakeQuaternary returns an Elem with the given quaternary value.
func (Elem) CCC ¶
CCC returns the canonical combining class associated with the underlying character, if applicable, or 0 otherwise.
func (Elem) Mask ¶
Mask sets weights for any level smaller than l to 0. The resulting Elem can be used to test for equality with other Elems to which the same mask has been applied.
func (Elem) Quaternary ¶
Quaternary returns the quaternary value if explicitly specified, 0 if ce == Ignore, or MaxQuaternary otherwise. Quaternary values are used only for shifted variants.
type Level ¶
type Level int
Level identifies the collation comparison level. The primary level corresponds to the basic sorting of text. The secondary level corresponds to accents and related linguistic elements. The tertiary level corresponds to casing and related concepts. The quaternary level is derived from the other levels by the various algorithms for handling variable elements.
const ( Primary Level = iota Secondary Tertiary Quaternary Identity NumLevels )
type Weighter ¶
type Weighter interface { // Start finds the start of the segment that includes position p. Start(p int, b []byte) int // StartString finds the start of the segment that includes position p. StartString(p int, s string) int // AppendNext appends Elems to buf corresponding to the longest match // of a single character or contraction from the start of s. // It returns the new buf and the number of bytes consumed. AppendNext(buf []Elem, s []byte) (ce []Elem, n int) // AppendNextString appends Elems to buf corresponding to the longest match // of a single character or contraction from the start of s. // It returns the new buf and the number of bytes consumed. AppendNextString(buf []Elem, s string) (ce []Elem, n int) // Domain returns a slice of all single characters and contractions for which // collation elements are defined in this table. Domain() []string // Top returns the highest variable primary value. Top() uint32 }
A Weighter can be used as a source for Collator and Searcher.
func NewNumericWeighter ¶
NewNumericWeighter wraps w to replace individual digits to sort based on their numeric value.
Weighter w must have a free primary weight after the primary weight for 9. If this is not the case, numeric value will sort at the same primary level as the first primary sorting after 9.