@@ -752,10 +752,53 @@ Example: two worksheets *ItemConf* and *ShopConf* in HelloWorld.xlsx:
752752
753753{{< sheet colored1 >}}
754754
755- | Sheet | OrderedIndex | |
756- | -------- | ---------------------------------------------- | --- |
757- | ItemConf | ID@Item, Name@AwardItem, (ID,Name)@SpecialItem | |
758- | ShopConf | ID@Shop, Type@ThemeShop, (ID,Type)@SpecialShop | |
755+ | Sheet | OrderedIndex | |
756+ | -------- | -------------------------------------------------------------------- | --- |
757+ | ItemConf | ID@Item, Name@AwardItem, (ID,Name)@SpecialItem | |
758+ | ShopConf | ID@Shop, Type@ThemeShop, (ID,Type)@SpecialShop , (ID,Type)<Type >@Shop | |
759+
760+ {{< /sheet >}}
761+
762+ {{< /spreadsheet >}}
763+
764+ Example with sorting: two worksheets * ItemConf* and * ShopConf* in HelloWorld.xlsx,
765+ with sorted result arrays using ` <> ` syntax:
766+
767+ - * ItemConf* : ordered index sorted by ` Name ` column.
768+ - * ShopConf* : ordered index sorted by ` Type ` and ` ID ` columns.
769+
770+ {{< spreadsheet "HelloWorld.xlsx" ItemConf ShopConf "@TABLEAU " >}}
771+
772+ {{< sheet colored >}}
773+
774+ | ID | Name | Desc |
775+ | ---------------- | ----------- | ----------------------------- |
776+ | map<int32, Item> | string | string |
777+ | Item's ID | Item's name | Item's desc |
778+ | 1 | Apple | A kind of delicious fruit. |
779+ | 2 | Orange | A kind of sour fruit. |
780+ | 3 | Banana | A kind of calorie-rich fruit. |
781+
782+ {{< /sheet >}}
783+
784+ {{< sheet colored >}}
785+
786+ | ID | Type | Desc |
787+ | ----------- | ----------- | ------------- |
788+ | [ Shop] int32 | int32 | string |
789+ | Shop's ID | Shop's type | Shop's desc |
790+ | 1 | 1 | Shoes shop. |
791+ | 2 | 1 | T-Shirt shop. |
792+ | 3 | 2 | Fruite shop. |
793+
794+ {{< /sheet >}}
795+
796+ {{< sheet colored1 >}}
797+
798+ | Sheet | OrderedIndex | |
799+ | -------- | ---------------------------------------------------------------------- | --- |
800+ | ItemConf | ID<Name >@Item , (ID,Name)<Name >@SpecialItem | |
801+ | ShopConf | ID<Type,ID>@Shop , (ID,Type)<Type,ID>@SpecialShop , (ID,Type)<Type >@Shop | |
759802
760803{{< /sheet >}}
761804
@@ -780,9 +823,131 @@ Examples:
780823- ` ID, Name@AwardItem `
781824- ` ID@Item, Name@AwardItem `
782825
826+ Example with sorting: a worksheet * ItemConf* in HelloWorld.xlsx, with sorted
827+ result array using ` <> ` syntax:
828+
829+ - ` ID<Name>@Item ` : single-column ordered index on ` ID ` , result array sorted by ` Name ` .
830+
831+ {{< spreadsheet "HelloWorld.xlsx" ItemConf "@TABLEAU " >}}
832+
833+ {{< sheet colored >}}
834+
835+ | ID | Name | Desc |
836+ | ---------------- | ----------- | ----------------------------- |
837+ | map<int32, Item> | string | string |
838+ | Item's ID | Item's name | Item's desc |
839+ | 1 | Apple | A kind of delicious fruit. |
840+ | 2 | Orange | A kind of sour fruit. |
841+ | 3 | Banana | A kind of calorie-rich fruit. |
842+
843+ {{< /sheet >}}
844+
845+ {{< sheet colored1 >}}
846+
847+ | Sheet | OrderedIndex |
848+ | -------- | ------------- |
849+ | ItemConf | ID<Name >@Item |
850+
851+ {{< /sheet >}}
852+
853+ {{< /spreadsheet >}}
854+
783855### Multi-column OrderedIndex
784856
785- > ⚠️ Not supported yet.
857+ Format: ` (Column1,Column2,...)<ColumnX,ColumnY,...>@IndexName ` .
858+
859+ Multi-column OrderedIndex (aka Composite OrderedIndex) is composed of ** multiple columns in the same struct** (in list or map) to increase query speed, and the result is returned as an ** ordered array** .
860+
861+ The sign ` @ ` is the separator between enclosed column names by parentheses and
862+ index name. If ` IndexName ` is not set, it will be this column's parent struct
863+ type name. One or more indexes can be specified by comma-separated rule. The
864+ columns in the angle brackets ` <> ` specify the sorting columns, which the
865+ ** result array** of same index key sort by.
866+
867+ Examples:
868+
869+ - ` (ID,Name) ` : index name not set, then determined by parent struct type name.
870+ - ` (ID,Name)@AwardItem `
871+ - ` (ID,Name)<ID> ` : sort result array by ID.
872+ - ` (ID,Type)<Type>@Shop ` : sort result array by Type.
873+ - ` (ID,Type)<Type,Priority>@Item ` : sort result array by Type and Priority.
874+ - ` ID@Item, (ID,Name)@AwardItem ` : one single-column ordered index and one multi-column ordered index.
875+
876+ #### Example: Multi-column OrderedIndex
877+
878+ Two worksheets * ItemConf* and * ShopConf* in HelloWorld.xlsx:
879+
880+ - * ItemConf* : multi-column ordered index on columns of the same struct as ** map value** .
881+ - * ShopConf* : multi-column ordered index on columns of the same struct as ** list element** .
882+
883+ {{< spreadsheet "HelloWorld.xlsx" ItemConf ShopConf "@TABLEAU " >}}
884+
885+ {{< sheet colored >}}
886+
887+ | ID | Name | Desc |
888+ | ---------------- | ----------- | ----------------------------- |
889+ | map<int32, Item> | string | string |
890+ | Item's ID | Item's name | Item's desc |
891+ | 1 | Apple | A kind of delicious fruit. |
892+ | 2 | Orange | A kind of sour fruit. |
893+ | 3 | Banana | A kind of calorie-rich fruit. |
894+
895+ {{< /sheet >}}
896+
897+ {{< sheet colored >}}
898+
899+ | ID | Type | Desc |
900+ | ----------- | ----------- | ------------- |
901+ | [ Shop] int32 | int32 | string |
902+ | Shop's ID | Shop's type | Shop's desc |
903+ | 1 | 1 | Shoes shop. |
904+ | 2 | 1 | T-Shirt shop. |
905+ | 3 | 2 | Fruite shop. |
906+
907+ {{< /sheet >}}
908+
909+ {{< sheet colored1 >}}
910+
911+ | Sheet | OrderedIndex |
912+ | -------- | ------------------------------------------- |
913+ | ItemConf | (ID,Name)@SpecialItem |
914+ | ShopConf | (ID,Type)@SpecialShop , (ID,Type)<Type >@Shop |
915+
916+ {{< /sheet >}}
917+
918+ {{< /spreadsheet >}}
919+
920+ #### Example: Multi-column OrderedIndex with ` <> ` syntax
921+
922+ A worksheet * ShopConf* in HelloWorld.xlsx, with sorted
923+ result array using ` <> ` syntax:
924+
925+ - ` (ID,Type)<Type>@Shop ` : multi-column ordered index on ` (ID, Type) ` , result array sorted by ` Type ` .
926+ - ` (ID,Type)<Type,ID>@SpecialShop ` : multi-column ordered index on ` (ID, Type) ` , result array sorted by ` Type ` then ` ID ` .
927+
928+ {{< spreadsheet "HelloWorld.xlsx" ShopConf "@TABLEAU " >}}
929+
930+ {{< sheet colored >}}
931+
932+ | ID | Type | Desc |
933+ | ----------- | ----------- | ------------- |
934+ | [ Shop] int32 | int32 | string |
935+ | Shop's ID | Shop's type | Shop's desc |
936+ | 1 | 1 | Shoes shop. |
937+ | 2 | 1 | T-Shirt shop. |
938+ | 3 | 2 | Fruite shop. |
939+
940+ {{< /sheet >}}
941+
942+ {{< sheet colored1 >}}
943+
944+ | Sheet | OrderedIndex |
945+ | -------- | ---------------------------------------------------- |
946+ | ShopConf | (ID,Type)<Type >@Shop , (ID,Type)<Type,ID>@SpecialShop |
947+
948+ {{< /sheet >}}
949+
950+ {{< /spreadsheet >}}
786951
787952## Option ` Patch `
788953
0 commit comments