Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IndexJSON ¶
IndexJSON is like IndexString expect for json. The "name" parameter should be a valid collate definition. The "path" parameter should be a valid gjson path.
Example ¶
var jsonA = `{"name":{"last":"Miller"}}` var jsonB = `{"name":{"last":"anderson"}}` less := IndexJSON("ENGLISH_CI", "name.last") fmt.Printf("%t\n", less(jsonA, jsonB)) fmt.Printf("%t\n", less(jsonB, jsonA))
Output: false true
func IndexString ¶
IndexString returns a Less function that can be used to compare if string "a" is less than string "b". The "name" parameter should be a valid collate definition.
Examples of collation names -------------------------------------------------------------------- ENGLISH, EN -- English AMERICANENGLISH, EN-US -- English US FRENCH, FR -- French CHINESE, ZH -- Chinese SIMPLIFIEDCHINESE, ZH-HANS -- Simplified Chinese ... Case insensitive: add the CI tag to the name -------------------------------------------------------------------- ENGLISH_CI FR_CI ZH-HANS_CI ... Case sensitive: add the CS tag to the name -------------------------------------------------------------------- ENGLISH_CS FR_CS ZH-HANS_CS ... For numerics: add the NUM tag to the name Specifies that numbers should sort numerically ("2" < "12") -------------------------------------------------------------------- DUTCH_NUM JAPANESE_NUM ... For loosness: add the LOOSE tag to the name Ignores diacritics, case and weight -------------------------------------------------------------------- JA_LOOSE CHINESE_LOOSE ...
Example ¶
var nameA = "Miller" var nameB = "anderson" less := IndexString("ENGLISH_CI") fmt.Printf("%t\n", less(nameA, nameB)) fmt.Printf("%t\n", less(nameB, nameA))
Output: false true
func SupportedLangs ¶
func SupportedLangs() []string
SupportedLangs returns all of the languages that Index() supports.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.