Skip to content

Commit 65ee6c0

Browse files
committed
feat: improve index docs
1 parent fb9370b commit 65ee6c0

File tree

10 files changed

+299
-119
lines changed

10 files changed

+299
-119
lines changed

content/en/docs/api/loader/cpp.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Get the `N`th-level map value. Returns `nullptr` if the key is not found. Be awa
2929

3030
> Prerequisite: You need to set metasheet option `OrderedMap` to `true`.
3131
>
32-
> See [metatsheet option: OrderedMap](../../../excel/metasheet/#option-orderedmap).
32+
> See [metasheet option: OrderedMap](../../../excel/metasheet/#option-orderedmap).
3333
3434
- `const OrderedMapMap* GetOrderedMap() const`: Gets the whole ordered map.
3535
- `const OrderedMapValueType* GetOrderedMap(KEY1 k1) const`: Gets the 2nd-level ordered map value. Returns `nullptr` if the key is not found.
@@ -38,30 +38,40 @@ Get the `N`th-level ordered map value. Be aware that only applies to each level
3838

3939
### Index
4040

41-
> Prerequisite: You need to set metatsheet option `Index` appropriately.
41+
> Prerequisite: You need to set metasheet option `Index` appropriately.
4242
>
43-
> See [metatsheet option: Index](../../../excel/metasheet/#option-index).
43+
> See [metasheet option: Index](../../../excel/metasheet/#option-index).
4444
45-
If index name is `Chapter`, then the accessers are:
45+
If index name is `Chapter`, then the accessors are:
4646

4747
- `const Index_ChapterMap& FindChapterMap() const`: Gets the whole hash map.
48-
- `const Index_ChapterMap* FindChapterMap(KEY1 k1, KEY2 k2...) const`: Gets the hash map scoped to the upper `N`th-level map specified by the given key(s).
4948
- `const vector<ParentType>* FindChapter(KEY1 k1, KEY2 k2...) const`: Finds values by key. One key may correspond to multiple values, which are returned by a vector.
5049
- `const ParentType* FindFirstChapter(KEY1 k1, KEY2 k2...) const`: Finds the first value by key, or `nullptr` if no value found.
5150

51+
If the indexed struct is nested within upper-level map containers, additional APIs are generated for each upper-level map to enable fast scoped lookup. Here `N` denotes the Nth upper-level map (e.g., `1` for the immediate parent map, `2` for the grandparent map, and so on).
52+
53+
- `const Index_ChapterMap* FindChapterMapN(MapKey1Type mapKey1, MapKey2Type mapKey2...) const`: Gets the whole hash map scoped to the specified upper-level map keys.
54+
- `const vector<ParentType>* FindChapterN(MapKey1Type mapKey1, MapKey2Type mapKey2..., KEY1 k1, KEY2 k2...) const`: Finds values by key within the specified upper-level map. One key may correspond to multiple values, which are returned by a vector.
55+
- `const ParentType* FindFirstChapterN(MapKey1Type mapKey1, MapKey2Type mapKey2..., KEY1 k1, KEY2 k2...) const`: Finds the first matching value by key within the specified upper-level map, or `nullptr` if no value found.
56+
5257
### OrderedIndex
5358

54-
> Prerequisite: You need to set metatsheet option `OrderedIndex` appropriately.
59+
> Prerequisite: You need to set metasheet option `OrderedIndex` appropriately.
5560
>
56-
> See [metatsheet option: OrderedIndex](../../../excel/metasheet/#option-orderedindex).
61+
> See [metasheet option: OrderedIndex](../../../excel/metasheet/#option-orderedindex).
5762
58-
If ordered index name is `Chapter`, then the accessers are:
63+
If ordered index name is `Chapter`, then the accessors are:
5964

6065
- `const OrderedIndex_ChapterMap& FindChapterMap() const`: Gets the whole ordered map.
61-
- `const OrderedIndex_ChapterMap* FindChapterMap(KEY1 k1, KEY2 k2...) const`: Gets the ordered map scoped to the upper `N`th-level map specified by the given key(s).
6266
- `const vector<ParentType>* FindChapter(KEY1 k1, KEY2 k2...) const`: Finds values by key. One key may correspond to multiple values, which are returned by a vector.
6367
- `const ParentType* FindFirstChapter(KEY1 k1, KEY2 k2...) const`: Finds the first value by key, or `nullptr` if no value found.
6468

69+
If the indexed struct is nested within upper-level map containers, additional APIs are generated for each upper-level map to enable fast scoped lookup. Here `N` denotes the Nth upper-level map (e.g., `1` for the immediate parent map, `2` for the grandparent map, and so on).
70+
71+
- `const OrderedIndex_ChapterMap* FindChapterMapN(MapKey1Type mapKey1, MapKey2Type mapKey2...) const`: Gets the whole ordered map scoped to the specified upper-level map keys.
72+
- `const vector<ParentType>* FindChapterN(MapKey1Type mapKey1, MapKey2Type mapKey2..., KEY1 k1, KEY2 k2...) const`: Finds values by key within the specified upper-level map. One key may correspond to multiple values, which are returned by a vector.
73+
- `const ParentType* FindFirstChapterN(MapKey1Type mapKey1, MapKey2Type mapKey2..., KEY1 k1, KEY2 k2...) const`: Finds the first matching value by key within the specified upper-level map, or `nullptr` if no value found.
74+
6575
## Custom messager
6676

6777
If the built-in APIs are not sufficient for your business logic, then you

content/en/docs/api/loader/csharp.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Get the `N`th-level map value. Be aware that only applies to each level message'
3131

3232
> Prerequisite: You need to set metasheet option `OrderedMap` to `true`.
3333
>
34-
> See [metatsheet option: OrderedMap](../../../excel/metasheet/#option-orderedmap).
34+
> See [metasheet option: OrderedMap](../../../excel/metasheet/#option-orderedmap).
3535
3636
- `public ref readonly OrderedMapMap GetOrderedMap()`: Gets the whole ordered map.
3737
- `public OrderedMapValueType? GetOrderedMap1(KEY1 k1)`: Gets the 1st-level ordered map value. Returns `null` if the key is not found.
@@ -41,28 +41,40 @@ Get the `N`th-level ordered map value. Be aware that only applies to each level
4141

4242
### Index
4343

44-
> Prerequisite: You need to set metatsheet option `Index` appropriately.
44+
> Prerequisite: You need to set metasheet option `Index` appropriately.
4545
>
46-
> See [metatsheet option: Index](../../../excel/metasheet/#option-index).
46+
> See [metasheet option: Index](../../../excel/metasheet/#option-index).
4747
48-
If index name is `Chapter`, then the accessers are:
48+
If index name is `Chapter`, then the accessors are:
4949

5050
- `public ref readonly Index_ChapterMap FindChapterMap()`: Gets the whole hash map.
5151
- `public List<ParentType>? FindChapter(KEY1 k1, KEY2 k2...)`: Finds values by key. One key may correspond to multiple values, which are returned by a list.
5252
- `public ParentType? FindFirstChapter(KEY1 k1, KEY2 k2...)`: Finds the first value by key, or `null` if no value found.
5353

54+
If the indexed struct is nested within upper-level map containers, additional APIs are generated for each upper-level map to enable fast scoped lookup. Here `N` denotes the Nth upper-level map (e.g., `1` for the immediate parent map, `2` for the grandparent map, and so on).
55+
56+
- `public Index_ChapterMap? FindChapterMapN(MapKey1Type mapKey1, MapKey2Type mapKey2...)`: Gets the whole hash map scoped to the specified upper-level map keys.
57+
- `public List<ParentType>? FindChapterN(MapKey1Type mapKey1, MapKey2Type mapKey2..., KEY1 k1, KEY2 k2...)`: Finds values by key within the specified upper-level map. One key may correspond to multiple values, which are returned by a list.
58+
- `public ParentType? FindFirstChapterN(MapKey1Type mapKey1, MapKey2Type mapKey2..., KEY1 k1, KEY2 k2...)`: Finds the first matching value by key within the specified upper-level map, or `null` if no value found.
59+
5460
### OrderedIndex
5561

56-
> Prerequisite: You need to set metatsheet option `OrderedIndex` appropriately.
62+
> Prerequisite: You need to set metasheet option `OrderedIndex` appropriately.
5763
>
58-
> See [metatsheet option: OrderedIndex](../../../excel/metasheet/#option-orderedindex).
64+
> See [metasheet option: OrderedIndex](../../../excel/metasheet/#option-orderedindex).
5965
60-
If ordered index name is `Chapter`, then the accessers are:
66+
If ordered index name is `Chapter`, then the accessors are:
6167

6268
- `public ref readonly OrderedIndex_ChapterMap FindChapterMap()`: Gets the whole ordered map.
6369
- `public List<ParentType>? FindChapter(KEY1 k1, KEY2 k2...)`: Finds values by key. One key may correspond to multiple values, which are returned by a list.
6470
- `public ParentType? FindFirstChapter(KEY1 k1, KEY2 k2...)`: Finds the first value by key, or `null` if no value found.
6571

72+
If the indexed struct is nested within upper-level map containers, additional APIs are generated for each upper-level map to enable fast scoped lookup. Here `N` denotes the Nth upper-level map (e.g., `1` for the immediate parent map, `2` for the grandparent map, and so on).
73+
74+
- `public OrderedIndex_ChapterMap? FindChapterMapN(MapKey1Type mapKey1, MapKey2Type mapKey2...)`: Gets the whole ordered map scoped to the specified upper-level map keys.
75+
- `public List<ParentType>? FindChapterN(MapKey1Type mapKey1, MapKey2Type mapKey2..., KEY1 k1, KEY2 k2...)`: Finds values by key within the specified upper-level map. One key may correspond to multiple values, which are returned by a list.
76+
- `public ParentType? FindFirstChapterN(MapKey1Type mapKey1, MapKey2Type mapKey2..., KEY1 k1, KEY2 k2...)`: Finds the first matching value by key within the specified upper-level map, or `null` if no value found.
77+
6678
## Custom messager
6779

6880
If the built-in APIs are not sufficient for your business logic, then you

content/en/docs/api/loader/go.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,48 @@ Get the `N`th-level map value. Be aware that only applies to each level message'
2828

2929
> Prerequisite: You need to set metasheet option `OrderedMap` to `true`.
3030
>
31-
> See [metatsheet option: OrderedMap](../../../excel/metasheet/#option-orderedmap).
31+
> See [metasheet option: OrderedMap](../../../excel/metasheet/#option-orderedmap).
3232
3333
`func GetOrderedMapN(k1 KEY1, k2 KEY2...) (*OrderedMapValueType, error)`
3434

3535
Get the `N`th-level ordered map value. Be aware that only applies to each level message's **first map field**.
3636

3737
### Index
3838

39-
> Prerequisite: You need to set metatsheet option `Index` appropriately.
39+
> Prerequisite: You need to set metasheet option `Index` appropriately.
4040
>
41-
> See [metatsheet option: Index](../../../excel/metasheet/#option-index).
41+
> See [metasheet option: Index](../../../excel/metasheet/#option-index).
4242
43-
If index name is `Chapter`, then the accessers are:
43+
If index name is `Chapter`, and the indexed keys are `k1, k2 ...`, then the accessors are:
4444

4545
- `func FindChapterMap() *Index_ChapterMap`: Gets the whole hash map.
46-
- `func FindChapter(k1 KEY1, k2 KEY2...) []*ParentType` Finds values by key. One key may correspond to multiple values, which are returned by a slice.
46+
- `func FindChapter(k1 KEY1, k2 KEY2...) []*ParentType`: Finds values by key. One key may correspond to multiple values, which are returned as a slice.
4747
- `func FindFirstChapter(k1 KEY1, k2 KEY2...) *ParentType`: Finds the first value by key.
4848

49+
If the indexed struct is nested within upper-level map containers, additional APIs are generated for each upper-level map to enable fast scoped lookup. Here `N` denotes the Nth upper-level map (e.g., `1` for the immediate parent map, `2` for the grandparent map, and so on).
50+
51+
- `func FindChapterMapN(mapKey1 MapKey1Type, mapKey2 MapKey2Type...) *Index_ChapterMap`: Gets the whole hash map scoped to the specified upper-level map keys.
52+
- `func FindChapterN(mapKey1 MapKey1Type, mapKey2 MapKey2Type..., k1 KEY1, k2 KEY2...) []*ParentType`: Finds values by key within the specified upper-level map. One key may correspond to multiple values, which are returned as a slice.
53+
- `func FindFirstChapterN(mapKey1 MapKey1Type, mapKey2 MapKey2Type..., k1 KEY1, k2 KEY2...) *ParentType`: Finds the first matching value by key within the specified upper-level map.
54+
4955
### OrderedIndex
5056

51-
> Prerequisite: You need to set metatsheet option `OrderedIndex` appropriately.
57+
> Prerequisite: You need to set metasheet option `OrderedIndex` appropriately.
5258
>
53-
> See [metatsheet option: OrderedIndex](../../../excel/metasheet/#option-orderedindex).
59+
> See [metasheet option: OrderedIndex](../../../excel/metasheet/#option-orderedindex).
5460
55-
If ordered index name is `Chapter`, then the accessers are:
61+
If ordered index name is `Chapter`, and the indexed keys are `k1, k2 ...`, then the accessors are:
5662

5763
- `func FindChapterMap() *OrderedIndex_ChapterMap`: Gets the whole ordered map.
58-
- `func FindChapter(k1 KEY1, k2 KEY2...) []*ParentType` Finds values by key. One key may correspond to multiple values, which are returned by a slice.
64+
- `func FindChapter(k1 KEY1, k2 KEY2...) []*ParentType`: Finds values by key. One key may correspond to multiple values, which are returned as a slice.
5965
- `func FindFirstChapter(k1 KEY1, k2 KEY2...) *ParentType`: Finds the first value by key.
6066

67+
If the indexed struct is nested within upper-level map containers, additional APIs are generated for each upper-level map to enable fast scoped lookup. Here `N` denotes the Nth upper-level map (e.g., `1` for the immediate parent map, `2` for the grandparent map, and so on).
68+
69+
- `func FindChapterMapN(mapKey1 MapKey1Type, mapKey2 MapKey2Type...) *OrderedIndex_ChapterMap`: Gets the whole ordered map scoped to the specified upper-level map keys.
70+
- `func FindChapterN(mapKey1 MapKey1Type, mapKey2 MapKey2Type..., k1 KEY1, k2 KEY2...) []*ParentType`: Finds values by key within the specified upper-level map. One key may correspond to multiple values, which are returned as a slice.
71+
- `func FindFirstChapterN(mapKey1 MapKey1Type, mapKey2 MapKey2Type..., k1 KEY1, k2 KEY2...) *ParentType`: Finds the first matching value by key within the specified upper-level map.
72+
6173
## Custom messager
6274

6375
If the built-in APIs are not sufficient for your business logic, then you

content/en/docs/excel/list-in-map.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,10 @@ message ItemConf {
377377

378378
{{< /details >}}
379379

380+
### Multiple horizontal lists in vertical-map
381+
382+
> TODO: add details and examples.
383+
380384
## Nested in horizontal-map
381385

382386
### Horizontal-list in horizontal-map

content/en/docs/excel/map-in-map.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ message ItemConf {
108108

109109
{{< /details >}}
110110

111+
### Multiple horizontal maps in vertical-map
112+
113+
> TODO: add details and examples.
114+
111115
### Vertical-map in vertical-map
112116

113117
A worksheet `ItemConf` in *HelloWorld.xlsx*:

0 commit comments

Comments
 (0)