From 7da42b4b09bb53a60adba4ae5795f931c54efe9e Mon Sep 17 00:00:00 2001 From: wenchy Date: Tue, 24 Sep 2024 22:13:14 +0800 Subject: [PATCH 1/3] feat: define enum types in sheet, fix doc timestamp --- config/_default/menus/menus.en.toml | 2 +- content/en/docs/_index.md | 4 +- content/en/docs/api/_index.md | 4 +- content/en/docs/api/checker/_index.md | 4 +- content/en/docs/api/checker/guide.md | 4 +- content/en/docs/api/loader/_index.md | 4 +- content/en/docs/api/loader/c++.md | 4 +- content/en/docs/api/loader/go.md | 4 +- content/en/docs/api/tableau/_index.md | 4 +- content/en/docs/api/tableau/guide.md | 4 +- content/en/docs/basics/_index.md | 4 +- content/en/docs/basics/concepts.md | 42 +-- content/en/docs/basics/enum.md | 5 +- content/en/docs/basics/grammar-and-types.md | 72 +---- content/en/docs/basics/predefined-types.md | 108 +------- content/en/docs/basics/wellknown-types.md | 87 ++++++ content/en/docs/csv/_index.md | 4 +- content/en/docs/csv/overview.md | 4 +- content/en/docs/design/_index.md | 4 +- content/en/docs/design/overview.md | 2 +- content/en/docs/excel/_index.md | 4 +- content/en/docs/excel/enum.md | 288 ++++++++++++++++++++ content/en/docs/excel/infinite-nesting.md | 4 +- content/en/docs/excel/list-in-list.md | 4 +- content/en/docs/excel/list-in-map.md | 4 +- content/en/docs/excel/list.md | 6 +- content/en/docs/excel/map-in-list.md | 4 +- content/en/docs/excel/map-in-map.md | 4 +- content/en/docs/excel/map.md | 6 +- content/en/docs/excel/metasheet.md | 4 +- content/en/docs/excel/scalar.md | 4 +- content/en/docs/excel/struct-in-list.md | 4 +- content/en/docs/excel/struct-in-map.md | 4 +- content/en/docs/excel/struct-in-struct.md | 4 +- content/en/docs/excel/struct.md | 6 +- content/en/docs/excel/union.md | 6 +- content/en/docs/excel/wellknown-types.md | 74 +++++ content/en/docs/help/_index.md | 4 +- content/en/docs/help/faq.md | 4 +- content/en/docs/help/how-to-update.md | 4 +- content/en/docs/help/troubleshooting.md | 4 +- content/en/docs/prologue/_index.md | 4 +- content/en/docs/prologue/introduction.md | 4 +- content/en/docs/prologue/quick-start.md | 4 +- content/en/docs/tutorial/_index.md | 4 +- content/en/docs/tutorial/overview.md | 4 +- content/en/docs/xml/_index.md | 4 +- 47 files changed, 568 insertions(+), 272 deletions(-) create mode 100644 content/en/docs/basics/wellknown-types.md create mode 100644 content/en/docs/excel/enum.md create mode 100644 content/en/docs/excel/wellknown-types.md diff --git a/config/_default/menus/menus.en.toml b/config/_default/menus/menus.en.toml index 9c2e2283..55888e8e 100644 --- a/config/_default/menus/menus.en.toml +++ b/config/_default/menus/menus.en.toml @@ -41,7 +41,7 @@ # name = "Twitter" # pre = "" # url = "https://twitter.com/getdoks" -# weight = 20 +# weight = 20 [[footer]] name = "Privacy" diff --git a/content/en/docs/_index.md b/content/en/docs/_index.md index e14643b5..5850fbc6 100644 --- a/content/en/docs/_index.md +++ b/content/en/docs/_index.md @@ -2,8 +2,8 @@ title : "Docs" description: "Docs Tableau." lead: "" -date: 2020-10-06T08:48:23+00:00 -lastmod: 2020-10-06T08:48:23+00:00 +date: 2020-10-06T08:48:23+08:00 +lastmod: 2020-10-06T08:48:23+08:00 draft: false images: [] weight: 9999 diff --git a/content/en/docs/api/_index.md b/content/en/docs/api/_index.md index 56c65bbd..7916c8c7 100644 --- a/content/en/docs/api/_index.md +++ b/content/en/docs/api/_index.md @@ -1,8 +1,8 @@ --- title : "API" description: "API guide." -date: 2022-09-04T08:48:45+00:00 -lastmod: 2022-09-04T08:48:45+00:00 +date: 2022-09-04T08:48:45+08:00 +lastmod: 2022-09-04T08:48:45+08:00 draft: false images: [] weight: 3000 diff --git a/content/en/docs/api/checker/_index.md b/content/en/docs/api/checker/_index.md index f84c3f07..d0c21c09 100644 --- a/content/en/docs/api/checker/_index.md +++ b/content/en/docs/api/checker/_index.md @@ -2,8 +2,8 @@ title: "Checker" description: "Checker guide." lead: "" -date: 2022-03-10T08:00:00+00:00 -lastmod: 2022-03-10T08:00:00+00:00 +date: 2022-03-10T08:00:00+08:00 +lastmod: 2022-03-10T08:00:00+08:00 draft: false images: [] weight: 3300 diff --git a/content/en/docs/api/checker/guide.md b/content/en/docs/api/checker/guide.md index 8f3cf631..3e68d1d8 100644 --- a/content/en/docs/api/checker/guide.md +++ b/content/en/docs/api/checker/guide.md @@ -2,8 +2,8 @@ title: "Guide" description: "Go checker guide." lead: "Go checker guide." -date: 2022-03-10T08:00:00+00:00 -lastmod: 2022-03-10T08:00:00+00:00 +date: 2022-03-10T08:00:00+08:00 +lastmod: 2022-03-10T08:00:00+08:00 draft: false images: [] weight: 300 diff --git a/content/en/docs/api/loader/_index.md b/content/en/docs/api/loader/_index.md index f43fdd47..bb643ca2 100644 --- a/content/en/docs/api/loader/_index.md +++ b/content/en/docs/api/loader/_index.md @@ -2,8 +2,8 @@ title: "Loader" description: "Loader guide." lead: "" -date: 2022-03-10T08:00:00+00:00 -lastmod: 2022-03-10T08:00:00+00:00 +date: 2022-03-10T08:00:00+08:00 +lastmod: 2022-03-10T08:00:00+08:00 draft: false images: [] weight: 3200 diff --git a/content/en/docs/api/loader/c++.md b/content/en/docs/api/loader/c++.md index cbf7c00f..f595fceb 100644 --- a/content/en/docs/api/loader/c++.md +++ b/content/en/docs/api/loader/c++.md @@ -2,8 +2,8 @@ title: "C++" description: "C++ loader guide." lead: "C++ loader guide." -date: 2022-03-10T08:00:00+00:00 -lastmod: 2022-03-10T08:00:00+00:00 +date: 2022-03-10T08:00:00+08:00 +lastmod: 2022-03-10T08:00:00+08:00 draft: false images: [] weight: 4201 diff --git a/content/en/docs/api/loader/go.md b/content/en/docs/api/loader/go.md index 21d2d319..b600be10 100644 --- a/content/en/docs/api/loader/go.md +++ b/content/en/docs/api/loader/go.md @@ -2,8 +2,8 @@ title: "Go" description: "Go loader guide." lead: "Go loader guide." -date: 2022-03-10T08:00:00+00:00 -lastmod: 2022-03-10T08:00:00+00:00 +date: 2022-03-10T08:00:00+08:00 +lastmod: 2022-03-10T08:00:00+08:00 draft: false images: [] weight: 4202 diff --git a/content/en/docs/api/tableau/_index.md b/content/en/docs/api/tableau/_index.md index 4265e067..45b5f8e9 100644 --- a/content/en/docs/api/tableau/_index.md +++ b/content/en/docs/api/tableau/_index.md @@ -2,8 +2,8 @@ title: "Tableau" description: "Tableau guide." lead: "" -date: 2022-03-10T08:00:00+00:00 -lastmod: 2022-03-10T08:00:00+00:00 +date: 2022-03-10T08:00:00+08:00 +lastmod: 2022-03-10T08:00:00+08:00 draft: false images: [] weight: 3100 diff --git a/content/en/docs/api/tableau/guide.md b/content/en/docs/api/tableau/guide.md index 2dd36dcd..4b3f0a9b 100644 --- a/content/en/docs/api/tableau/guide.md +++ b/content/en/docs/api/tableau/guide.md @@ -2,8 +2,8 @@ title: "Guide" description: "This guide gets you started with Tableau in Go with a simple working example." lead: "This guide gets you started with Tableau in Go with a simple working example." -date: 2020-11-16T13:59:39+01:00 -lastmod: 2020-11-16T13:59:39+01:00 +date: 2020-11-16T13:59:39+08:00 +lastmod: 2020-11-16T13:59:39+08:00 draft: false images: [] weight: 4101 diff --git a/content/en/docs/basics/_index.md b/content/en/docs/basics/_index.md index 2da6f718..a5e82309 100644 --- a/content/en/docs/basics/_index.md +++ b/content/en/docs/basics/_index.md @@ -2,8 +2,8 @@ title : "Basics" description: "Basics of Tableau." lead: "" -date: 2020-10-06T08:48:45+00:00 -lastmod: 2020-10-06T08:48:45+00:00 +date: 2020-10-06T08:48:45+08:00 +lastmod: 2020-10-06T08:48:45+08:00 draft: false images: [] weight: 8000 diff --git a/content/en/docs/basics/concepts.md b/content/en/docs/basics/concepts.md index 77fba09d..6c0ca822 100644 --- a/content/en/docs/basics/concepts.md +++ b/content/en/docs/basics/concepts.md @@ -2,8 +2,8 @@ title: "Concepts" description: "Core concepts of Tableau." lead: "Core concepts of Tableau." -date: 2022-02-26T13:59:39+01:00 -lastmod: 2022-02-26T13:59:39+01:00 +date: 2022-02-26T13:59:39+08:00 +lastmod: 2022-02-26T13:59:39+08:00 draft: false images: [] weight: 8100 @@ -14,22 +14,22 @@ toc: true ### Basics -| Term | Definition | -|--------------|------------------------------------------------------------------------------------------------------| -| `Workbook` | An excel file.
A XML file.
A bundle of CSV files named with the same prefix seperated by `#`. | -| `Worksheet` | A sheet in a excel file.
A root node of a XML file.
A CSV file. | -| `Metasheet` | A worksheet named `@TABLEAU` to specify tableau parser options. | -| `Row` | The row in a sheet. | -| `Column` | The column in a sheet. | -| `Cell` | The intersection of a row and a column. | -| `In-cell` | The inner-side of a cell. | -| `Cross-cell` | Continuous cells of a row or a column. | +| Term | Definition | +| ------------ | ---------------------------------------------------------------------------------------------------------------------- | +| `Workbook` | An excel file.
A bundle of CSV files named with the same prefix seperated by `#`.
A XML file.
A YAML file. | +| `Worksheet` | A sheet in a excel file.
A CSV file.
A root node of a XML file.
A document in YAML file. | +| `Metasheet` | A worksheet named `@TABLEAU` to specify tableau parser options. | +| `Row` | The row in a sheet. | +| `Column` | The column in a sheet. | +| `Cell` | The intersection of a row and a column. | +| `In-cell` | The inner-side of a cell. | +| `Cross-cell` | Continuous cells of a row or a column. | {.table-striped .table-hover} ### Worksheet | Term | Definition | -|-------------|----------------------------------------------------------------------------------------------------------------------------------------| +| ----------- | -------------------------------------------------------------------------------------------------------------------------------------- | | `Namerow` | Exact row number of column name definition at a worksheet.
⚠️ NOTE: each column name must be unique in a worksheet!
Default: `1`. | | `Typerow` | Exact row number of column type definition at a worksheet.
Default: `2`. | | `Noterow` | Exact row number of column note at a worksheet.
Default: `3`. | @@ -46,7 +46,7 @@ toc: true ## Mappings to Protoconf | Term | Protoconf | -|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| +| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Workbook` | One protoconf(`.proto`) file. | | `Worksheet` | One top-level [message](https://developers.google.com/protocol-buffers/docs/proto3#simple) in a protoconf file, except the tableau metasheet named `@TABLEAU`. | | `column` | One field in a [message](https://developers.google.com/protocol-buffers/docs/proto3#simple) | @@ -62,7 +62,7 @@ A workbook(*HelloWorld.xlsx*) with two data worksheets(`ItemConf` and `ActivityC {{< sheet colored>}} | ID | Name | Type | -|-------------------|--------------|--------------| +| ----------------- | ------------ | ------------ | | map | string | int32 | | Item's ID. | Item's name. | Item's type. | | 1 | item1 | 100 | @@ -74,7 +74,7 @@ A workbook(*HelloWorld.xlsx*) with two data worksheets(`ItemConf` and `ActivityC {{< sheet colored>}} | ID | Name | Open | -|-----------------------|------------------|-------------------| +| --------------------- | ---------------- | ----------------- | | map | string | bool | | Activity's ID. | Activity's name. | Activity is open? | | 1 | activity1 | true | @@ -85,11 +85,11 @@ A workbook(*HelloWorld.xlsx*) with two data worksheets(`ItemConf` and `ActivityC {{< sheet >}} -| | | | -|---|---|---| -| | | | -| | | | -| | | | +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | {{< /sheet >}} diff --git a/content/en/docs/basics/enum.md b/content/en/docs/basics/enum.md index f19c7220..9f97c3c9 100644 --- a/content/en/docs/basics/enum.md +++ b/content/en/docs/basics/enum.md @@ -2,8 +2,8 @@ title: "Enum" description: "Enum features." lead: "This guide demonstrates different features of enum type." -date: 2022-02-26T13:59:39+01:00 -lastmod: 2022-02-26T13:59:39+01:00 +date: 2022-02-26T13:59:39+08:00 +lastmod: 2022-02-26T13:59:39+08:00 draft: false images: [] weight: 8300 @@ -37,6 +37,7 @@ Then the three forms of enum value are all accepted: | 1 | FRUIT_TYPE_APPLE | Apple | | 2 | FRUIT_TYPE_ORANGE | Orange | | 3 | FRUIT_TYPE_BANANA | Banana | +{.table-striped} > NOTE: Enum type must be predefined. diff --git a/content/en/docs/basics/grammar-and-types.md b/content/en/docs/basics/grammar-and-types.md index a0807657..0971d08f 100644 --- a/content/en/docs/basics/grammar-and-types.md +++ b/content/en/docs/basics/grammar-and-types.md @@ -2,8 +2,8 @@ title: "Grammar and types" description: "Grammar and types." lead: "This guide discusses Tableau's basic grammar, variable declarations, and data types." -date: 2022-02-26T13:59:39+01:00 -lastmod: 2022-02-26T13:59:39+01:00 +date: 2022-02-26T13:59:39+08:00 +lastmod: 2022-02-26T13:59:39+08:00 draft: false images: [] weight: 8200 @@ -24,75 +24,8 @@ Tableau borrows most of its syntax and types from [Protocol Buffers (proto3)](ht | Booleans | `bool` | `false` | | Strings | `string` | `""` | | Bytes | `bytes` | `""` | - -## Well-known types - -### Datetime - -| Type | Default | Description | -| ---------- | --------------------- | ------------------------------------------------------------------------------------------------------- | -| `datetime` | `0000-00-00 00:00:00` | Format: `yyyy-MM-dd HH:mm:ss`.
e.g.: `2020-01-01 05:10:00`. | -| `date` | `0000-00-00` | Format: `yyyy-MM-dd` or `yyyyMMdd`.
e.g.: `2020-01-01` or `20200101`. | -| `time` | `00:00:00` | Format: `HH:mm:ss` or `HHmmss`, `HH:mm` or `HHmm`.
e.g.: `05:10:00` or `051000`, `05:10` or `0510`. | {.table-striped} -#### Tips - -- `datetime` and `date` are based on [**google.protobuf.Timestamp**](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp), see [JSON mapping](https://developers.google.com/protocol-buffers/docs/proto3#json). -- `time` is based on [**google.protobuf.Duration**](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration), see [JSON mapping](https://developers.google.com/protocol-buffers/docs/proto3#json). - -### Duration - -| Type | Default | Description | -| ---------- | ------- | ---------------------------------------------------------------------------------------------------------------- | -| `duration` | `0s` | Format like: `72h3m0.5s`.
Refer [golang duration string form](https://golang.org/pkg/time/#Duration.String). | -{.table-striped} - -#### Tips - -- `duration` is based on [**google.protobuf.Duration**](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration), see [JSON mapping](https://developers.google.com/protocol-buffers/docs/proto3#json). - -### Fraction - -A fraction represents a part of a whole or, more generally, any number of equal parts. See [wiki: Fraction](https://en.wikipedia.org/wiki/Fraction) for more details. - -| Type | Default | Description | -| ---------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `fraction` | `0` | Format:
- `N%`: percentage, e.g.: `10%`
- `N‰`: per thounsand, e.g.: `10‰`
- `N‱`: per ten thounsand, e.g.: `10‱`
- `N/D`: simple fraction, e.g.: `3/4`
- `N`: only numerator, e.g.: `3` is same to `3/1` | -{.table-striped} - -```protobuf -message Fraction { - int32 num = 1; // numerator - int32 den = 2; // denominator -} -``` - -### Comparator - -A comparator holds a `sign` and a fraction `value`. Any number or fraction can compare with it. - -| Type | Default | Description | -| ------------ | ------- | -------------------------------------------------------------------------------------- | -| `comparator` | `==0` | Format: ``.
e.g.: `==10`, `!=1/2`, `<10%` `<=10‰`, `>%10`, `>=10‱` | -{.table-striped} - -```protobuf -message Comparator { - Sign sign = 1; - Fraction value = 2; - - enum Sign { - SIGN_EQUAL = 0; // == - SIGN_NOT_EQUAL = 1; // != - SIGN_LESS = 2; // < - SIGN_LESS_OR_EQUAL = 3; // <= - SIGN_GREATER = 4; // > - SIGN_GREATER_OR_EQUAL = 5; // >= - } -} -``` - ## Composite types | Type | Description | @@ -100,6 +33,7 @@ message Comparator { | `struct` | A struct is mapped to a protobuf **message**. | | `list` | A list is mapped to a protobuf **repeated** field. | | `map` | A map is mapped to a protobuf **map** field. | +{.table-striped} ### struct diff --git a/content/en/docs/basics/predefined-types.md b/content/en/docs/basics/predefined-types.md index 7c592d78..79d76cf9 100644 --- a/content/en/docs/basics/predefined-types.md +++ b/content/en/docs/basics/predefined-types.md @@ -2,111 +2,23 @@ title: "Predefined types" description: "Predefined types." lead: "Tableau support predefined types to be imported, then you can use it in Excel/CSV/XML/YAML." -date: 2022-02-26T08:48:57+00:00 -lastmod: 2022-02-26T08:48:57+00:00 +date: 2022-02-26T08:48:57+08:00 +lastmod: 2022-02-26T08:48:57+08:00 draft: false images: [] -weight: 8400 +weight: 8500 toc: true --- ## Overview -You can define `enum` or `struct` types in a protoconf file (such as `common.proto`) ahead. It means you create predefined types, and then can use them to specify the column type or cross-cell struct type of a worksheet. +You can define `enum` or `struct` types in a protoconf file (such as `common.proto`) ahead. It means you can create predefined types, and then can use them to specify the column type or cross-cell struct type of a worksheet. ## Usage - Syntax: prepend a dot `.` to predefined `CustomType` (a.k.a. `.CustomType`) when you use it in a worksheet. - Import: specify the `importedProtoFiles` option of **tableauc** config to import the common proto files, where predefined `enum` or `struct` types are defined. Refer: [Tableau Options](https://github.com/tableauio/tableau/blob/master/options/options.go#L105). -## Enum - -The basic enum guide, please go to read [Enum →]({{< relref "enum" >}}) - -For example, enum type `FruitType` in `common.proto` is defined as: - -```protobuf -enum FruitType { - FRUIT_TYPE_UNKNOWN = 0 [(tableau.evalue).name = "Unknown"]; - FRUIT_TYPE_APPLE = 1 [(tableau.evalue).name = "Apple"]; - FRUIT_TYPE_ORANGE = 2 [(tableau.evalue).name = "Orange"]; - FRUIT_TYPE_BANANA = 4 [(tableau.evalue).name = "Banana"]; -} -``` - -A worksheet `ItemConf` in *HelloWorld.xlsx*: - -{{< spreadsheet "HelloWorld.xlsx" ItemConf "@TABLEAU" >}} - -{{< sheet colored >}} - -| ID | Type | -|-------------------|-------------------| -| map | enum<.FruitType> | -| Item's ID | Fruit's type | -| 1 | 1 | -| 2 | Orange | -| 3 | FRUIT_TYPE_BANANA | - -{{< /sheet >}} - -{{< sheet >}} - -| | | | -|---|---|---| -| | | | -| | | | -| | | | - -{{< /sheet >}} - -{{< /spreadsheet >}} - -Generated: - -{{< details "hello_world.proto" open >}} - -```protobuf -// --snip-- -import "common.proto"; -option (tableau.workbook) = {name:"HelloWorld.xlsx"}; - -message ItemConf { - option (tableau.worksheet) = {name:"ItemConf" namerow:1 typerow:2 noterow:3 datarow:4}; - - map item_map = 1 [(tableau.field) = {key:"ID" layout:LAYOUT_VERTICAL}]; - message Item { - uint32 id = 1 [(tableau.field) = {name:"ID"}]; - FruitType type = 2 [(tableau.field) = {name:"Type"}]; - } -} -``` - -{{< /details >}} - -{{< details "ItemConf.json" >}} - -```json -{ - "itemMap": { - "1": { - "id": 1, - "type": "FRUIT_TYPE_APPLE" - }, - "2": { - "id": 3, - "type": "FRUIT_TYPE_ORANGE" - } - "3": { - "id": 2, - "type": "FRUIT_TYPE_BANANA" - }, - } -} -``` - -{{< /details >}} - ## Struct For example, struct type `Prop` in `common.proto` is defined as: @@ -125,7 +37,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Prop1ID | Prop1Value | Prop2ID | Prop2Value | -|-------------------|--------------|---------------|------------|---------------| +| ----------------- | ------------ | ------------- | ---------- | ------------- | | map | [.Prop]int32 | int32 | int32 | int32 | | Item's ID | Prop1's ID | Prop1's value | Prop2's ID | Prop2's value | | 1 | 1 | 100 | 2 | 200 | @@ -136,11 +48,11 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} -| | | | -|---|---|---| -| | | | -| | | | -| | | | +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | {{< /sheet >}} diff --git a/content/en/docs/basics/wellknown-types.md b/content/en/docs/basics/wellknown-types.md new file mode 100644 index 00000000..a47bd099 --- /dev/null +++ b/content/en/docs/basics/wellknown-types.md @@ -0,0 +1,87 @@ +--- +title: "Wellknown types" +description: "Wellknown types." +lead: "Wellknown types contain common types that are used throughout the Tableau ecosystem." +date: 2024-09-24T15:59:39+08:00 +lastmod: 2024-09-24T15:59:39+08:00 +draft: false +images: [] +weight: 8400 +toc: true +--- + +## Overview + +For easy use, Wellknown types are built-in types in Tableau. +This concept is much like [Protocol Buffers Well-Known Types](https://protobuf.dev/reference/protobuf/google.protobuf/). + +You should include the proto files provided by Tableau and Protocol Buffers: + +- [tableau/protobuf/wellknown.proto](https://github.com/tableauio/tableau/blob/master/proto/tableau/protobuf/wellknown.proto) +- [google/protobuf/timestamp.proto](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/timestamp.proto) +- [google/protobuf/duration.proto](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/duration.proto) + +## Datetime + +| Type | Default | Description | +| ---------- | --------------------- | ------------------------------------------------------------------------------------------------------- | +| `datetime` | `0000-00-00 00:00:00` | Format: `yyyy-MM-dd HH:mm:ss`.
e.g.: `2020-01-01 05:10:00`. | +| `date` | `0000-00-00` | Format: `yyyy-MM-dd` or `yyyyMMdd`.
e.g.: `2020-01-01` or `20200101`. | +| `time` | `00:00:00` | Format: `HH:mm:ss` or `HHmmss`, `HH:mm` or `HHmm`.
e.g.: `05:10:00` or `051000`, `05:10` or `0510`. | +{.table-striped} + +### Tips + +- `datetime` and `date` are based on [**google.protobuf.Timestamp**](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp), see [JSON mapping](https://developers.google.com/protocol-buffers/docs/proto3#json). +- `time` is based on [**google.protobuf.Duration**](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration), see [JSON mapping](https://developers.google.com/protocol-buffers/docs/proto3#json). + +## Duration + +| Type | Default | Description | +| ---------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `duration` | `0s` | Format like: `72h3m0.5s`.
A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as `300ms`, `-1.5h` or `2h45m`.
Valid time units are `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. | + +### Tips + +- `duration` is based on [**google.protobuf.Duration**](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration), see [JSON mapping](https://developers.google.com/protocol-buffers/docs/proto3#json). +- [golang duration string form](https://golang.org/pkg/time/#Duration.String). +- [golang ParseDuration](https://pkg.go.dev/time#ParseDuration). + +## Fraction + +A fraction represents a part of a whole or, more generally, any number of equal parts. See [wiki: Fraction](https://en.wikipedia.org/wiki/Fraction) for more details. + +| Type | Default | Description | +| ---------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `fraction` | `0` | Format:
- `N%`: percentage, e.g.: `10%`
- `N‰`: per thounsand, e.g.: `10‰`
- `N‱`: per ten thounsand, e.g.: `10‱`
- `N/D`: simple fraction, e.g.: `3/4`
- `N`: only numerator, e.g.: `3` is same to `3/1` | + +```protobuf +message Fraction { + int32 num = 1; // numerator + int32 den = 2; // denominator +} +``` + +## Comparator + +A comparator holds a `sign` and a fraction `value`. Any number or fraction can compare with it. + +| Type | Default | Description | +| ------------ | ------- | -------------------------------------------------------------------------------------- | +| `comparator` | `==0` | Format: ``.
e.g.: `==10`, `!=1/2`, `<10%` `<=10‰`, `>10%`, `>=10‱` | + +```protobuf +message Comparator { + Sign sign = 1; + Fraction value = 2; + + enum Sign { + SIGN_EQUAL = 0; // == + SIGN_NOT_EQUAL = 1; // != + SIGN_LESS = 2; // < + SIGN_LESS_OR_EQUAL = 3; // <= + SIGN_GREATER = 4; // > + SIGN_GREATER_OR_EQUAL = 5; // >= + } +} +``` diff --git a/content/en/docs/csv/_index.md b/content/en/docs/csv/_index.md index 168bc8a2..868a28c0 100644 --- a/content/en/docs/csv/_index.md +++ b/content/en/docs/csv/_index.md @@ -1,8 +1,8 @@ --- title : "CSV" description: "CSV guide." -date: 2022-03-08T08:48:45+00:00 -lastmod: 2022-03-08T08:48:45+00:00 +date: 2022-03-08T08:48:45+08:00 +lastmod: 2022-03-08T08:48:45+08:00 draft: false images: [] weight: 6000 diff --git a/content/en/docs/csv/overview.md b/content/en/docs/csv/overview.md index a33ed116..298028dc 100644 --- a/content/en/docs/csv/overview.md +++ b/content/en/docs/csv/overview.md @@ -2,8 +2,8 @@ title: "Overview" description: "CSV overview." lead: "Intro to CSV workbook and worksheet." -date: 2022-02-26T13:59:39+01:00 -lastmod: 2022-02-26T13:59:39+01:00 +date: 2022-02-26T13:59:39+08:00 +lastmod: 2022-02-26T13:59:39+08:00 draft: false images: [] weight: 6100 diff --git a/content/en/docs/design/_index.md b/content/en/docs/design/_index.md index 6faaafd0..c88aca89 100644 --- a/content/en/docs/design/_index.md +++ b/content/en/docs/design/_index.md @@ -1,8 +1,8 @@ --- title: "Design" description: "The Doks Blog." -date: 2020-10-06T08:49:55+00:00 -lastmod: 2020-10-06T08:49:55+00:00 +date: 2020-10-06T08:49:55+08:00 +lastmod: 2020-10-06T08:49:55+08:00 draft: false images: [] weight: 2000 diff --git a/content/en/docs/design/overview.md b/content/en/docs/design/overview.md index 9d6d0c8c..6a0db4ee 100644 --- a/content/en/docs/design/overview.md +++ b/content/en/docs/design/overview.md @@ -257,7 +257,7 @@ workbook meta sheet **@TABLEAU**: > `2019-10-12T07:20:50.52Z # This is acceptable in ISO 8601 and RFC 3339 (with T)` > `2019-10-12 07:20:50.52Z # This is only accepted in RFC 3339 (without T)` > -> - "Z" stands for **Zero timezone** or **Zulu timezone** `UTC+0`, and equal to `+00:00` in the RFC 3339. +> - "Z" stands for **Zero timezone** or **Zulu timezone** `UTC+0`, and equal to `+08:00` in the RFC 3339. > - **RFC 3339** follows the **ISO 8601** DateTime format. The only difference is RFC allows us to replace "T" with "space". Use [RFC 3339](https://tools.ietf.org/html/rfc3339) , which is following [ISO 8601](https://www.wikiwand.com/en/ISO_8601). diff --git a/content/en/docs/excel/_index.md b/content/en/docs/excel/_index.md index 918ebcf8..78d03bb8 100644 --- a/content/en/docs/excel/_index.md +++ b/content/en/docs/excel/_index.md @@ -1,8 +1,8 @@ --- title : "Excel" description: "Excel guide." -date: 2022-03-08T08:48:45+00:00 -lastmod: 2022-03-08T08:48:45+00:00 +date: 2022-03-08T08:48:45+08:00 +lastmod: 2022-03-08T08:48:45+08:00 draft: false images: [] weight: 7000 diff --git a/content/en/docs/excel/enum.md b/content/en/docs/excel/enum.md new file mode 100644 index 00000000..47e29363 --- /dev/null +++ b/content/en/docs/excel/enum.md @@ -0,0 +1,288 @@ +--- +title: "Enum" +description: "Enum features." +lead: "This guide demonstrates different features of Enum type." +date: 2024-09-24T14:00:00+08:00 +lastmod: 2024-09-24T14:00:00+08:00 +draft: false +images: [] +weight: 7102 +toc: true +--- + +## Use predefined enum type + +The basic enum guide, please go to read [Enum →]({{< relref "enum" >}}) + +For example, enum type `FruitType` in `common.proto` is defined as: + +```protobuf +enum FruitType { + FRUIT_TYPE_UNKNOWN = 0 [(tableau.evalue).name = "Unknown"]; + FRUIT_TYPE_APPLE = 1 [(tableau.evalue).name = "Apple"]; + FRUIT_TYPE_ORANGE = 2 [(tableau.evalue).name = "Orange"]; + FRUIT_TYPE_BANANA = 4 [(tableau.evalue).name = "Banana"]; +} +``` + +A worksheet `ItemConf` in *HelloWorld.xlsx*: + +{{< spreadsheet "HelloWorld.xlsx" ItemConf "@TABLEAU" >}} + +{{< sheet colored >}} + +| ID | Type | +| ----------------- | ----------------- | +| map | enum<.FruitType> | +| Item's ID | Fruit's type | +| 1 | 1 | +| 2 | Orange | +| 3 | FRUIT_TYPE_BANANA | + +{{< /sheet >}} + +{{< sheet >}} + +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + +{{< /sheet >}} + +{{< /spreadsheet >}} + +Generated: + +{{< details "hello_world.proto" open >}} + +```protobuf +// --snip-- +import "common.proto"; +option (tableau.workbook) = {name:"HelloWorld.xlsx"}; + +message ItemConf { + option (tableau.worksheet) = {name:"ItemConf" namerow:1 typerow:2 noterow:3 datarow:4}; + + map item_map = 1 [(tableau.field) = {key:"ID" layout:LAYOUT_VERTICAL}]; + message Item { + uint32 id = 1 [(tableau.field) = {name:"ID"}]; + FruitType type = 2 [(tableau.field) = {name:"Type"}]; + } +} +``` + +{{< /details >}} + +{{< details "ItemConf.json" >}} + +```json +{ + "itemMap": { + "1": { + "id": 1, + "type": "FRUIT_TYPE_APPLE" + }, + "2": { + "id": 3, + "type": "FRUIT_TYPE_ORANGE" + } + "3": { + "id": 2, + "type": "FRUIT_TYPE_BANANA" + }, + } +} +``` + +{{< /details >}} + +## Define enum type in sheet + +### Simple example + +A worksheet `ItemType` in *HelloWorld.xlsx*: + +{{< spreadsheet "HelloWorld.xlsx" Apple "@TABLEAU" >}} + +{{< sheet colored>}} + +| Name | Alias | +| --------------- | ----- | +| ITEM_TYPE_FRUIT | Fruit | +| ITEM_TYPE_EQUIP | Equip | +| ITEM_TYPE_BOX | Box | + +{{< /sheet >}} + +{{< sheet >}} + +{{< /sheet >}} + +{{< /spreadsheet >}} + +Generated: + +{{< details "hello_world.proto" open >}} + +```protobuf +// --snip-- +option (tableau.workbook) = {name:"HelloWorld.xlsx"}; + +// Generated from sheet: ItemType. +enum ItemType { + ITEM_TYPE_INVALID = 0; + ITEM_TYPE_FRUIT = 1 [(tableau.evalue).name = "Fruit"]; + ITEM_TYPE_EQUIP = 2 [(tableau.evalue).name = "Equip"]; + ITEM_TYPE_BOX = 3 [(tableau.evalue).name = "Box"]; +} +``` + +{{< /details >}} + +### Specify Number column + +A worksheet `ItemType` in *HelloWorld.xlsx*: + +{{< spreadsheet "HelloWorld.xlsx" ItemType "@TABLEAU" >}} + +{{< sheet colored>}} + +| Number | Name | Alias | +| ------ | ----------------- | ------- | +| 0 | ITEM_TYPE_UNKNOWN | Unknown | +| 10 | ITEM_TYPE_FRUIT | Fruit | +| 20 | ITEM_TYPE_EQUIP | Equip | +| 30 | ITEM_TYPE_BOX | Box | + +{{< /sheet >}} + +{{< sheet >}} + +| Sheet | Mode | +| -------- | -------------- | +| ItemType | MODE_TYPE_ENUM | + +{{< /sheet >}} + +{{< /spreadsheet >}} + +Generated: + +{{< details "hello_world.proto" open >}} + +```protobuf +// --snip-- +option (tableau.workbook) = {name:"HelloWorld.xlsx"}; + +// Generated from sheet: ItemType. +enum ItemType { + ITEM_TYPE_UNKNOWN = 0 [(tableau.evalue).name = "Unknown"]; + ITEM_TYPE_FRUIT = 10 [(tableau.evalue).name = "Fruit"]; + ITEM_TYPE_EQUIP = 20 [(tableau.evalue).name = "Equip"]; + ITEM_TYPE_BOX = 30 [(tableau.evalue).name = "Box"]; +} +``` + +{{< /details >}} + +## Define and use enum type in sheet + +Two worksheets `ItemType` and `ItemConf` in *HelloWorld.xlsx*: + +{{< spreadsheet "HelloWorld.xlsx" ItemType ItemConf "@TABLEAU" >}} + +{{< sheet colored >}} + +| Name | Alias | +| --------------- | ----- | +| ITEM_TYPE_FRUIT | Fruit | +| ITEM_TYPE_EQUIP | Equip | +| ITEM_TYPE_BOX | Box | + +{{< /sheet >}} + +{{< sheet >}} + +| ID | Type | Name | Price | +| ---------------- | --------------- | ----------- | ------------ | +| map | enum<.ItemType> | string | int32 | +| Item’s ID | Item’s type | Item’s name | Item’s price | +| 1 | Fruit | Apple | 40 | +| 2 | Fruit | Orange | 20 | +| 3 | Equip | Sword | 10 | + +{{< /sheet >}} + +{{< sheet >}} + +| Sheet | Mode | +| -------- | -------------- | +| ItemType | MODE_TYPE_ENUM | +| ItemConf | | + +{{< /sheet >}} + +{{< /spreadsheet >}} + +Generated: + +{{< details "hello_world.proto" open >}} + +```protobuf +// --snip-- +import "common.proto"; +option (tableau.workbook) = {name:"HelloWorld.xlsx"}; + +// Generated from sheet: ItemType. +enum ItemType { + ITEM_TYPE_INVALID = 0; + ITEM_TYPE_FRUIT = 1 [(tableau.evalue).name = "Fruit"]; + ITEM_TYPE_EQUIP = 2 [(tableau.evalue).name = "Equip"]; + ITEM_TYPE_BOX = 3 [(tableau.evalue).name = "Box"]; +} + +message ItemConf { + option (tableau.worksheet) = {name:"ItemConf" namerow:1 typerow:2 noterow:3 datarow:4}; + + map item_map = 1 [(tableau.field) = {key:"ID" layout:LAYOUT_VERTICAL}]; + message Item { + int32 id = 1 [(tableau.field) = {name:"ID"}]; + protoconf.ItemType type = 2 [(tableau.field) = {name:"Type"}]; + string name = 3 [(tableau.field) = {name:"Name"}]; + int32 price = 4 [(tableau.field) = {name:"Price"}]; + } +} +``` + +{{< /details >}} + +{{< details "ItemConf.json" >}} + +```json +{ + "itemMap": { + "1": { + "id": 1, + "type": "ITEM_TYPE_FRUIT", + "name": "Apple", + "price": 40 + }, + "2": { + "id": 2, + "type": "ITEM_TYPE_FRUIT", + "name": "Orange", + "price": 20 + }, + "3": { + "id": 3, + "type": "ITEM_TYPE_EQUIP", + "name": "Sword", + "price": 10 + } + } +} +``` + +{{< /details >}} diff --git a/content/en/docs/excel/infinite-nesting.md b/content/en/docs/excel/infinite-nesting.md index 1354e654..caf1a842 100644 --- a/content/en/docs/excel/infinite-nesting.md +++ b/content/en/docs/excel/infinite-nesting.md @@ -2,8 +2,8 @@ title: "Infinite nesting" description: "Infinite nesting." lead: "Infinite nesting of composite types." -date: 2022-02-26T08:48:57+00:00 -lastmod: 2022-02-26T08:48:57+00:00 +date: 2022-02-26T08:48:57+08:00 +lastmod: 2022-02-26T08:48:57+08:00 draft: false images: [] weight: 7500 diff --git a/content/en/docs/excel/list-in-list.md b/content/en/docs/excel/list-in-list.md index b544e3c1..9d545b82 100644 --- a/content/en/docs/excel/list-in-list.md +++ b/content/en/docs/excel/list-in-list.md @@ -2,8 +2,8 @@ title: "List in list" description: "The nesting specification of list in list." lead: "The nesting specification of list in list." -date: 2022-02-26T08:48:57+00:00 -lastmod: 2022-02-26T08:48:57+00:00 +date: 2022-02-26T08:48:57+08:00 +lastmod: 2022-02-26T08:48:57+08:00 draft: false images: [] weight: 7301 diff --git a/content/en/docs/excel/list-in-map.md b/content/en/docs/excel/list-in-map.md index 6daf4588..532cff41 100644 --- a/content/en/docs/excel/list-in-map.md +++ b/content/en/docs/excel/list-in-map.md @@ -2,8 +2,8 @@ title: "List in map" description: "The nesting specification of list in map." lead: "The nesting specification of list in map." -date: 2022-02-26T08:48:57+00:00 -lastmod: 2022-02-26T08:48:57+00:00 +date: 2022-02-26T08:48:57+08:00 +lastmod: 2022-02-26T08:48:57+08:00 draft: false images: [] weight: 7302 diff --git a/content/en/docs/excel/list.md b/content/en/docs/excel/list.md index 6f741f96..2751b97e 100644 --- a/content/en/docs/excel/list.md +++ b/content/en/docs/excel/list.md @@ -2,11 +2,11 @@ title: "List" description: "List features." lead: "This guide demonstrates different features of list type." -date: 2022-02-26T13:59:39+01:00 -lastmod: 2022-02-26T13:59:39+01:00 +date: 2022-02-26T13:59:39+08:00 +lastmod: 2022-02-26T13:59:39+08:00 draft: false images: [] -weight: 7104 +weight: 7106 toc: true --- diff --git a/content/en/docs/excel/map-in-list.md b/content/en/docs/excel/map-in-list.md index 3f4d80a7..4b3f670f 100644 --- a/content/en/docs/excel/map-in-list.md +++ b/content/en/docs/excel/map-in-list.md @@ -2,8 +2,8 @@ title: "Map in list" description: "The nesting specification of map in list." lead: "The nesting specification of map in list." -date: 2022-02-26T08:48:57+00:00 -lastmod: 2022-02-26T08:48:57+00:00 +date: 2022-02-26T08:48:57+08:00 +lastmod: 2022-02-26T08:48:57+08:00 draft: false images: [] weight: 7401 diff --git a/content/en/docs/excel/map-in-map.md b/content/en/docs/excel/map-in-map.md index 4c89ee38..6e44a4e9 100644 --- a/content/en/docs/excel/map-in-map.md +++ b/content/en/docs/excel/map-in-map.md @@ -2,8 +2,8 @@ title: "Map in map" description: "The nesting specification of map in map." lead: "The nesting specification of map in map." -date: 2022-02-26T08:48:57+00:00 -lastmod: 2022-02-26T08:48:57+00:00 +date: 2022-02-26T08:48:57+08:00 +lastmod: 2022-02-26T08:48:57+08:00 draft: false images: [] weight: 7402 diff --git a/content/en/docs/excel/map.md b/content/en/docs/excel/map.md index d8a64bee..6aa711df 100644 --- a/content/en/docs/excel/map.md +++ b/content/en/docs/excel/map.md @@ -2,11 +2,11 @@ title: "Map" description: "Map features." lead: "This guide demonstrates different features of map type." -date: 2022-02-26T13:59:39+01:00 -lastmod: 2022-02-26T13:59:39+01:00 +date: 2022-02-26T13:59:39+08:00 +lastmod: 2022-02-26T13:59:39+08:00 draft: false images: [] -weight: 7105 +weight: 7107 toc: true --- diff --git a/content/en/docs/excel/metasheet.md b/content/en/docs/excel/metasheet.md index 5fbd328b..bee6a7dd 100644 --- a/content/en/docs/excel/metasheet.md +++ b/content/en/docs/excel/metasheet.md @@ -2,8 +2,8 @@ title: "Metasheet" description: "The metasheet is a worksheet named \"@TABLEAU\" to specify tableau parser options." lead: "The metasheet is a worksheet named \"@TABLEAU\" to specify tableau parser options." -date: 2022-02-26T13:59:39+01:00 -lastmod: 2024-09-03T13:59:39+01:00 +date: 2022-02-26T13:59:39+08:00 +lastmod: 2024-09-03T13:59:39+08:00 draft: false images: [] weight: 7902 diff --git a/content/en/docs/excel/scalar.md b/content/en/docs/excel/scalar.md index c9ea791e..062a647a 100644 --- a/content/en/docs/excel/scalar.md +++ b/content/en/docs/excel/scalar.md @@ -2,8 +2,8 @@ title: "Scalar" description: "Scalar features." lead: "This guide demonstrates different features of scalar type." -date: 2022-09-04T13:59:39+01:00 -lastmod: 2022-09-04T13:59:39+01:00 +date: 2022-09-04T13:59:39+08:00 +lastmod: 2022-09-04T13:59:39+08:00 draft: false images: [] weight: 7101 diff --git a/content/en/docs/excel/struct-in-list.md b/content/en/docs/excel/struct-in-list.md index 5aafbc58..586cfc77 100644 --- a/content/en/docs/excel/struct-in-list.md +++ b/content/en/docs/excel/struct-in-list.md @@ -2,8 +2,8 @@ title: "Struct in list" description: "The nesting specification of struct in list." lead: "The nesting specification of struct in list." -date: 2022-02-26T08:48:57+00:00 -lastmod: 2022-02-26T08:48:57+00:00 +date: 2022-02-26T08:48:57+08:00 +lastmod: 2022-02-26T08:48:57+08:00 draft: false images: [] weight: 7202 diff --git a/content/en/docs/excel/struct-in-map.md b/content/en/docs/excel/struct-in-map.md index 371db3ae..825d2b2d 100644 --- a/content/en/docs/excel/struct-in-map.md +++ b/content/en/docs/excel/struct-in-map.md @@ -2,8 +2,8 @@ title: "Struct in map" description: "The nesting specification of struct in map." lead: "The nesting specification of struct in map." -date: 2022-02-26T08:48:57+00:00 -lastmod: 2022-02-26T08:48:57+00:00 +date: 2022-02-26T08:48:57+08:00 +lastmod: 2022-02-26T08:48:57+08:00 draft: false images: [] weight: 7203 diff --git a/content/en/docs/excel/struct-in-struct.md b/content/en/docs/excel/struct-in-struct.md index c74066e5..18efdd17 100644 --- a/content/en/docs/excel/struct-in-struct.md +++ b/content/en/docs/excel/struct-in-struct.md @@ -2,8 +2,8 @@ title: "Struct in struct" description: "The nesting specification of struct in struct." lead: "The nesting specification of struct in struct." -date: 2022-02-26T08:48:57+00:00 -lastmod: 2022-02-26T08:48:57+00:00 +date: 2022-02-26T08:48:57+08:00 +lastmod: 2022-02-26T08:48:57+08:00 draft: false images: [] weight: 7201 diff --git a/content/en/docs/excel/struct.md b/content/en/docs/excel/struct.md index b2aaa679..1e384d7b 100644 --- a/content/en/docs/excel/struct.md +++ b/content/en/docs/excel/struct.md @@ -2,11 +2,11 @@ title: "Struct" description: "Struct features." lead: "This guide demonstrates different features of struct type." -date: 2022-02-26T13:59:39+01:00 -lastmod: 2022-02-26T13:59:39+01:00 +date: 2022-02-26T13:59:39+08:00 +lastmod: 2022-02-26T13:59:39+08:00 draft: false images: [] -weight: 7102 +weight: 7104 toc: true --- diff --git a/content/en/docs/excel/union.md b/content/en/docs/excel/union.md index dcfe5db2..8988b991 100644 --- a/content/en/docs/excel/union.md +++ b/content/en/docs/excel/union.md @@ -2,11 +2,11 @@ title: "Union" description: "Union type features." lead: "This guide demonstrates different features of union type." -date: 2022-09-04T13:59:39+01:00 -lastmod: 2022-09-04T13:59:39+01:00 +date: 2022-09-04T13:59:39+08:00 +lastmod: 2022-09-04T13:59:39+08:00 draft: false images: [] -weight: 7103 +weight: 7105 toc: true --- diff --git a/content/en/docs/excel/wellknown-types.md b/content/en/docs/excel/wellknown-types.md new file mode 100644 index 00000000..2b463da1 --- /dev/null +++ b/content/en/docs/excel/wellknown-types.md @@ -0,0 +1,74 @@ +--- +title: "Wellknown types" +description: "Wellknown features." +lead: "This guide demonstrates different features of Wellknown types." +date: 2024-09-24T14:00:00+08:00 +lastmod: 2024-09-24T14:00:00+08:00 +draft: false +images: [] +weight: 7103 +toc: true +--- + +## Scalar + +A worksheet `Apple` in *HelloWorld.xlsx*: + +{{< spreadsheet "HelloWorld.xlsx" Apple "@TABLEAU" >}} + +{{< sheet colored>}} + +| ID | Name | Desc | +|-----------|-------------|----------------------------| +| uint32 | string | string | +| Item's ID | Item's Name | Item's Description | +| 1 | Apple | A kind of delicious fruit. | + +{{< /sheet >}} + +{{< sheet >}} + +{{< /sheet >}} + +{{< /spreadsheet >}} + +In this worksheet, three scalar fields are defined: + +1. ID: `uint32` +2. Name: `string` +3. Desc: `string` + +Generated: + +{{< details "hello_world.proto" open >}} + +```protobuf +// --snip-- +option (tableau.workbook) = {name:"HelloWorld.xlsx"}; + +message Apple { + option (tableau.worksheet) = {name:"Apple" namerow:1 typerow:2 noterow:3 datarow:4}; + + uint32 id = 1 [(tableau.field) = {name:"ID"}]; + string name = 2 [(tableau.field) = {name:"Name"}]; + string desc = 3 [(tableau.field) = {name:"Desc"}]; +} +``` + +{{< /details >}} + +{{< details "Apple.json" >}} + +```json +{ + "id": 1, + "name": "Apple", + "desc": "A kind of delicious fruit." +} +``` + +{{< /details >}} + +### Note + +Scalar type is usually used to define fields of struct type. [Struct →]({{< relref "struct" >}}) diff --git a/content/en/docs/help/_index.md b/content/en/docs/help/_index.md index b24e6011..7fec6ce0 100644 --- a/content/en/docs/help/_index.md +++ b/content/en/docs/help/_index.md @@ -2,8 +2,8 @@ title: "Help" description: "Help Tableau." lead: "" -date: 2020-10-06T08:49:15+00:00 -lastmod: 2020-10-06T08:49:15+00:00 +date: 2020-10-06T08:49:15+08:00 +lastmod: 2020-10-06T08:49:15+08:00 draft: false images: [] weight: 1000 diff --git a/content/en/docs/help/faq.md b/content/en/docs/help/faq.md index 86acd713..2087a151 100644 --- a/content/en/docs/help/faq.md +++ b/content/en/docs/help/faq.md @@ -2,8 +2,8 @@ title: "FAQ" description: "Answers to frequently asked questions." lead: "Answers to frequently asked questions." -date: 2020-10-06T08:49:31+00:00 -lastmod: 2020-10-06T08:49:31+00:00 +date: 2020-10-06T08:49:31+08:00 +lastmod: 2020-10-06T08:49:31+08:00 draft: false images: [] weight: 1003 diff --git a/content/en/docs/help/how-to-update.md b/content/en/docs/help/how-to-update.md index a3ba6dd6..7ddcf5cb 100644 --- a/content/en/docs/help/how-to-update.md +++ b/content/en/docs/help/how-to-update.md @@ -2,8 +2,8 @@ title: "How to Update" description: "Regularly update the installed toolchain to keep your tableau stable, usable, and secure." lead: "Regularly update the installed toolchain to keep your tableau stable, usable, and secure." -date: 2020-11-12T13:26:54+01:00 -lastmod: 2020-11-12T13:26:54+01:00 +date: 2020-11-12T13:26:54+08:00 +lastmod: 2020-11-12T13:26:54+08:00 draft: false images: [] weight: 1001 diff --git a/content/en/docs/help/troubleshooting.md b/content/en/docs/help/troubleshooting.md index 520f0f95..18074065 100644 --- a/content/en/docs/help/troubleshooting.md +++ b/content/en/docs/help/troubleshooting.md @@ -2,8 +2,8 @@ title: "Troubleshooting" description: "Solutions to common problems." lead: "Solutions to common problems." -date: 2020-11-12T15:22:20+01:00 -lastmod: 2020-11-12T15:22:20+01:00 +date: 2020-11-12T15:22:20+08:00 +lastmod: 2020-11-12T15:22:20+08:00 draft: false images: [] weight: 1002 diff --git a/content/en/docs/prologue/_index.md b/content/en/docs/prologue/_index.md index 7f70ead9..ab65963d 100644 --- a/content/en/docs/prologue/_index.md +++ b/content/en/docs/prologue/_index.md @@ -2,8 +2,8 @@ title : "Prologue" description: "Prologue of Tableau" lead: "" -date: 2020-10-06T08:48:45+00:00 -lastmod: 2020-10-06T08:48:45+00:00 +date: 2020-10-06T08:48:45+08:00 +lastmod: 2020-10-06T08:48:45+08:00 draft: false images: [] weight: 9900 diff --git a/content/en/docs/prologue/introduction.md b/content/en/docs/prologue/introduction.md index 0590a9d9..71407948 100644 --- a/content/en/docs/prologue/introduction.md +++ b/content/en/docs/prologue/introduction.md @@ -2,8 +2,8 @@ title: "Introduction" description: "Intro to Tableau." lead: "A modern configuration converter for converting Excel/CSV/XML/YAML to multiple formats: JSON, Text, and Bin. Powered by Protobuf (proto3)." -date: 2020-10-06T08:48:57+00:00 -lastmod: 2020-10-06T08:48:57+00:00 +date: 2020-10-06T08:48:57+08:00 +lastmod: 2020-10-06T08:48:57+08:00 draft: false images: [] weight: 9901 diff --git a/content/en/docs/prologue/quick-start.md b/content/en/docs/prologue/quick-start.md index cf479c8b..684fd511 100644 --- a/content/en/docs/prologue/quick-start.md +++ b/content/en/docs/prologue/quick-start.md @@ -2,8 +2,8 @@ title: "Quick Start" description: "Quick Start" lead: "One page summary of how to convert a workbook file to proto and JSON files by tableauc." -date: 2020-11-16T13:59:39+01:00 -lastmod: 2020-11-16T13:59:39+01:00 +date: 2020-11-16T13:59:39+08:00 +lastmod: 2020-11-16T13:59:39+08:00 draft: false images: [] weight: 9902 diff --git a/content/en/docs/tutorial/_index.md b/content/en/docs/tutorial/_index.md index c83cf655..be73d517 100644 --- a/content/en/docs/tutorial/_index.md +++ b/content/en/docs/tutorial/_index.md @@ -2,8 +2,8 @@ title : "Tutorial" description: "Tutorial of Tableau" lead: "" -date: 2022-09-06T08:48:45+00:00 -lastmod: 2022-09-06T08:48:45+00:00 +date: 2022-09-06T08:48:45+08:00 +lastmod: 2022-09-06T08:48:45+08:00 draft: false images: [] weight: 9800 diff --git a/content/en/docs/tutorial/overview.md b/content/en/docs/tutorial/overview.md index f5286da4..eadfe3fc 100644 --- a/content/en/docs/tutorial/overview.md +++ b/content/en/docs/tutorial/overview.md @@ -2,8 +2,8 @@ title: "Overview" description: "Overview" lead: "Welcome to Tableau! This tutorial will guide you through setting up and running tableauc, loader, and checker." -date: 2020-11-16T13:59:39+01:00 -lastmod: 2020-11-16T13:59:39+01:00 +date: 2020-11-16T13:59:39+08:00 +lastmod: 2020-11-16T13:59:39+08:00 draft: false images: [] weight: 9801 diff --git a/content/en/docs/xml/_index.md b/content/en/docs/xml/_index.md index e6c77b23..38c286c6 100644 --- a/content/en/docs/xml/_index.md +++ b/content/en/docs/xml/_index.md @@ -2,8 +2,8 @@ title : "XML" description: "XML guide." lead: "XML guide." -date: 2020-10-06T08:48:45+00:00 -lastmod: 2020-10-06T08:48:45+00:00 +date: 2020-10-06T08:48:45+08:00 +lastmod: 2020-10-06T08:48:45+08:00 draft: false images: [] weight: 5000 From 20d7f66723bd80c441ec5f0ae793dff8643dd56f Mon Sep 17 00:00:00 2001 From: wenchy Date: Wed, 25 Sep 2024 12:00:24 +0800 Subject: [PATCH 2/3] feat: add empty @TABLEAU sheet --- config/_default/menus/menus.en.toml | 2 +- content/en/docs/excel/enum.md | 6 ++ content/en/docs/excel/field-property.md | 6 ++ content/en/docs/excel/list-in-list.md | 40 +++++++-- content/en/docs/excel/list-in-map.md | 24 ++++- content/en/docs/excel/list.md | 102 ++++++++++++++++++++++ content/en/docs/excel/map-in-list.md | 40 +++++++-- content/en/docs/excel/map-in-map.md | 24 ++++- content/en/docs/excel/map.md | 95 +++++++++++++++++--- content/en/docs/excel/scalar.md | 8 +- content/en/docs/excel/struct-in-list.md | 40 +++++++-- content/en/docs/excel/struct-in-map.md | 24 ++++- content/en/docs/excel/struct-in-struct.md | 24 ++++- content/en/docs/excel/struct.md | 40 +++++++-- content/en/docs/excel/union.md | 24 ++++- content/en/docs/prologue/quick-start.md | 8 +- 16 files changed, 455 insertions(+), 52 deletions(-) diff --git a/config/_default/menus/menus.en.toml b/config/_default/menus/menus.en.toml index 55888e8e..3ee6ccb8 100644 --- a/config/_default/menus/menus.en.toml +++ b/config/_default/menus/menus.en.toml @@ -41,7 +41,7 @@ # name = "Twitter" # pre = "" # url = "https://twitter.com/getdoks" -# weight = 20 +# weight = 20 [[footer]] name = "Privacy" diff --git a/content/en/docs/excel/enum.md b/content/en/docs/excel/enum.md index 47e29363..aa35b87f 100644 --- a/content/en/docs/excel/enum.md +++ b/content/en/docs/excel/enum.md @@ -118,6 +118,12 @@ A worksheet `ItemType` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} diff --git a/content/en/docs/excel/field-property.md b/content/en/docs/excel/field-property.md index e6855950..fdf8f1f4 100644 --- a/content/en/docs/excel/field-property.md +++ b/content/en/docs/excel/field-property.md @@ -123,6 +123,12 @@ For example, a worksheet `ItemConf` in `HelloWorld.xlsx`: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} diff --git a/content/en/docs/excel/list-in-list.md b/content/en/docs/excel/list-in-list.md index 9d545b82..a4b533c8 100644 --- a/content/en/docs/excel/list-in-list.md +++ b/content/en/docs/excel/list-in-list.md @@ -21,7 +21,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Name | Prop1ID | Prop1Value | Prop2ID | Prop2Value | -|--------------|-------------|-------------|---------------|------------|---------------| +| ------------ | ----------- | ----------- | ------------- | ---------- | ------------- | | [Item]uint32 | string | [Prop]int32 | int64 | int32 | int64 | | Item's ID | Item's name | Prop1's ID | Prop1's value | Prop2's ID | Prop2's value | | 1 | Apple | 1 | 10 | 2 | 20 | @@ -32,6 +32,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -111,7 +117,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Name | PropID | PropValue | -|------------------|-------------|-------------|--------------| +| ---------------- | ----------- | ----------- | ------------ | | [Item]\ | string | [Prop]int32 | int64 | | Item's ID | Item's name | Prop's ID | Prop's value | | 1 | Apple | 1 | 10 | @@ -122,6 +128,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -196,7 +208,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Prop | -|--------------|--------------| +| ------------ | ------------ | | [Item]uint32 | []int32 | | Item's ID | Item's props | | 1 | 10,20,30 | @@ -207,6 +219,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -275,7 +293,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | Reward1Item1ID | Reward1Item1Num | Reward1Item2ID | Reward1Item2Num | Reward1Name | Reward2Item1ID | Reward2Item1Num | Reward2Name | -|---------------------|-----------------|----------------|-----------------|---------------|----------------|-----------------|---------------| +| ------------------- | --------------- | -------------- | --------------- | ------------- | -------------- | --------------- | ------------- | | [Reward][Item]int32 | int32 | int32 | int32 | string | int32 | int32 | string | | Item1's ID | Item1's num | Item2's ID | Item2's num | Reward's name | Item1's ID | Item1's num | Reward's name | | 1 | 10 | 2 | 20 | Lotto | 10 | 100 | Super Lotto | @@ -284,6 +302,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -364,7 +388,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | Reward1Item1ID | Reward1Item1Num | Reward1Item2ID | Reward1Item2Num | Reward1Name | Reward2Item1ID | Reward2Item1Num | Reward2Name | -|----------------------|-----------------|----------------|-----------------|---------------|----------------|-----------------|---------------| +| -------------------- | --------------- | -------------- | --------------- | ------------- | -------------- | --------------- | ------------- | | [Reward][.Item]int32 | int32 | int32 | int32 | string | int32 | int32 | string | | Item1's ID | Item1's num | Item2's ID | Item2's num | Reward's name | Item1's ID | Item1's num | Reward's name | | 1 | 10 | 2 | 20 | Lotto | 10 | 100 | Super Lotto | @@ -373,6 +397,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} diff --git a/content/en/docs/excel/list-in-map.md b/content/en/docs/excel/list-in-map.md index 532cff41..510286cd 100644 --- a/content/en/docs/excel/list-in-map.md +++ b/content/en/docs/excel/list-in-map.md @@ -21,7 +21,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Name | Prop1ID | Prop1Value | Prop2ID | Prop2Value | -|-------------------|-------------|-------------|---------------|------------|---------------| +| ----------------- | ----------- | ----------- | ------------- | ---------- | ------------- | | map | string | [Prop]int32 | int64 | int32 | int64 | | Item's ID | Item's name | Prop1's ID | Prop1's value | Prop2's ID | Prop2's value | | 1 | Apple | 1 | 10 | 2 | 20 | @@ -32,6 +32,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -111,7 +117,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Name | PropID | PropValue | -|-------------------|-------------|-------------|--------------| +| ----------------- | ----------- | ----------- | ------------ | | map | string | [Prop]int32 | int64 | | Item's ID | Item's name | Prop's ID | Prop's value | | 1 | Apple | 1 | 10 | @@ -122,6 +128,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -196,7 +208,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Prop | -|-------------------|--------------| +| ----------------- | ------------ | | map | []int32 | | Item's ID | Item's props | | 1 | 10,20,30 | @@ -207,6 +219,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} diff --git a/content/en/docs/excel/list.md b/content/en/docs/excel/list.md index 2751b97e..57ae4e22 100644 --- a/content/en/docs/excel/list.md +++ b/content/en/docs/excel/list.md @@ -37,6 +37,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -101,6 +107,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -155,6 +167,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -230,6 +248,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -293,6 +317,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -368,6 +398,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -447,6 +483,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -528,6 +570,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -593,6 +641,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -670,6 +724,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -742,6 +802,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -811,6 +877,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -883,6 +955,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*. {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -953,6 +1031,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -1019,6 +1103,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -1120,6 +1210,12 @@ For example, a worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -1200,6 +1296,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} diff --git a/content/en/docs/excel/map-in-list.md b/content/en/docs/excel/map-in-list.md index 4b3f670f..796e23c5 100644 --- a/content/en/docs/excel/map-in-list.md +++ b/content/en/docs/excel/map-in-list.md @@ -21,7 +21,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Name | Prop1ID | Prop1Value | Prop2ID | Prop2Value | -|--------------|-------------|------------------|---------------|------------|---------------| +| ------------ | ----------- | ---------------- | ------------- | ---------- | ------------- | | [Item]uint32 | string | map | int64 | int32 | int64 | | Item's ID | Item's name | Prop1's ID | Prop1's value | Prop2's ID | Prop2's value | | 1 | Apple | 1 | 10 | 2 | 20 | @@ -32,6 +32,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -111,7 +117,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Name | PropID | PropValue | -|------------------|-------------|------------------|--------------| +| ---------------- | ----------- | ---------------- | ------------ | | [Item]\ | string | map | int64 | | Item's ID | Item's name | Prop's ID | Prop's value | | 1 | Apple | 1 | 10 | @@ -122,6 +128,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -196,7 +208,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Props | -|--------------|----------------------------| +| ------------ | -------------------------- | | [Item]uint32 | map\ | | Item's ID | Item's props | | 1 | 1:sour,2:sweet,3:delicious | @@ -207,6 +219,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -275,7 +293,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | Reward1Item1ID | Reward1Item1Num | Reward1Item2ID | Reward1Item2Num | Reward1Name | Reward2Item1ID | Reward2Item1Num | Reward2Name | -|--------------------------|-----------------|----------------|-----------------|---------------|----------------|-----------------|---------------| +| ------------------------ | --------------- | -------------- | --------------- | ------------- | -------------- | --------------- | ------------- | | [Reward]map | int32 | int32 | int32 | string | int32 | int32 | string | | Item1's ID | Item1's num | Item2's ID | Item2's num | Reward's name | Item1's ID | Item1's num | Reward's name | | 1 | 10 | 2 | 20 | Lotto | 10 | 100 | Super Lotto | @@ -284,6 +302,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -364,7 +388,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | Reward1Item1ID | Reward1Item1Num | Reward1Item2ID | Reward1Item2Num | Reward1Name | Reward2Item1ID | Reward2Item1Num | Reward2Name | -|---------------------------|-----------------|----------------|-----------------|---------------|----------------|-----------------|---------------| +| ------------------------- | --------------- | -------------- | --------------- | ------------- | -------------- | --------------- | ------------- | | [Reward]map | int32 | int32 | int32 | string | int32 | int32 | string | | Item1's ID | Item1's num | Item2's ID | Item2's num | Reward's name | Item1's ID | Item1's num | Reward's name | | 1 | 10 | 2 | 20 | Lotto | 10 | 100 | Super Lotto | @@ -373,6 +397,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} diff --git a/content/en/docs/excel/map-in-map.md b/content/en/docs/excel/map-in-map.md index 6e44a4e9..c08ce89c 100644 --- a/content/en/docs/excel/map-in-map.md +++ b/content/en/docs/excel/map-in-map.md @@ -21,7 +21,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Name | Prop1ID | Prop1Value | Prop2ID | Prop2Value | -|-------------------|-------------|------------------|---------------|------------|---------------| +| ----------------- | ----------- | ---------------- | ------------- | ---------- | ------------- | | map | string | map | int64 | int32 | int64 | | Item's ID | Item's name | Prop1's ID | Prop1's value | Prop2's ID | Prop2's value | | 1 | Apple | 1 | 10 | 2 | 20 | @@ -32,6 +32,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -111,7 +117,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Name | PropID | PropValue | -|-------------------|-------------|------------------|--------------| +| ----------------- | ----------- | ---------------- | ------------ | | map | string | map | int64 | | Item's ID | Item's name | Prop's ID | Prop's value | | 1 | Apple | 1 | 10 | @@ -122,6 +128,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -196,7 +208,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Props | -|-------------------|----------------------------| +| ----------------- | -------------------------- | | map | map | | Item's ID | Item's props | | 1 | 1:sour,2:sweet,3:delicious | @@ -207,6 +219,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} diff --git a/content/en/docs/excel/map.md b/content/en/docs/excel/map.md index 6aa711df..7774ce58 100644 --- a/content/en/docs/excel/map.md +++ b/content/en/docs/excel/map.md @@ -31,7 +31,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | Item1ID | Item1Name | Item2ID | Item2Name | Item3ID | Item3Name | -|-------------------|--------------|------------|--------------|------------|--------------| +| ----------------- | ------------ | ---------- | ------------ | ---------- | ------------ | | map | string | uint32 | string | uint32 | string | | Item1's ID | Item1's name | Item2's ID | Item2's name | Item3's ID | Item3's name | | 1 | Apple | 2 | Orange | 3 | Banana | @@ -40,6 +40,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -106,7 +112,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | Item1ID | Item1Num | Item2ID | Item2Num | Item3ID | Item3Num | -|-------------------|-------------|------------|-------------|------------|-------------| +| ----------------- | ----------- | ---------- | ----------- | ---------- | ----------- | | map | int32 | int32 | int32 | int32 | int32 | | Item1's ID | Item1's num | Item2's ID | Item3's num | Item3's ID | Item3's num | | 1 | 100 | 2 | 200 | 3 | 300 | @@ -115,6 +121,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -181,7 +193,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Name | Desc | -|-------------------|-------------|-------------------------------| +| ----------------- | ----------- | ----------------------------- | | map | string | string | | Item’s ID | Item’s name | Item’s desc | | 1 | Apple | A kind of delicious fruit. | @@ -192,6 +204,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -262,7 +280,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Num | -|-------------------|------------| +| ----------------- | ---------- | | map | int32 | | Item's ID | Item's num | | 1 | 100 | @@ -273,6 +291,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -334,7 +358,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | Items | -|------------------------------------| +| ---------------------------------- | | map | | Items | | 1:Apple,2:Orange,3:Banana,4,:Peach | @@ -343,6 +367,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -414,7 +444,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | Fruit | Flavor | Item | -|------------------------------|--------------------------------|-------------------------------------------| +| ---------------------------- | ------------------------------ | ----------------------------------------- | | map, int64> | map> | map, enum<.FruitFlavor>> | | Fruits | Flavors | Items | | Apple:1,Orange:2 | 1:Fragrant,2:Sweet | Apple:Fragrant,Orange:Sour | @@ -423,6 +453,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -499,7 +535,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Desc | -|-------------------|-------------| +| ----------------- | ----------- | | map | string | | Item's ID | Item's name | | 1 | Apple | @@ -510,6 +546,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -600,7 +642,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | Type | Price | -|-----------------------------|--------------| +| --------------------------- | ------------ | | map, Item> | int32 | | Item's type | Item's price | | Apple | 100 | @@ -611,6 +653,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -683,7 +731,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | Item1ID | Item1Name | Item2ID | Item2Name | Item3ID | Item3Name | -|---------------------------------|--------------|------------|--------------|------------|--------------| +| ------------------------------- | ------------ | ---------- | ------------ | ---------- | ------------ | | map\|{fixed:true} | string | uint32 | string | uint32 | string | | Item1's ID | Item1's name | Item2's ID | Item2's name | Item3's ID | Item3's name | | 1 | Apple | | | 3 | Banana | @@ -692,6 +740,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -755,7 +809,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | Item1ID | Item1Name | Item2ID | Item2Name | Item3ID | Item3Name | -|-----------------------------|--------------|------------|--------------|------------|--------------| +| --------------------------- | ------------ | ---------- | ------------ | ---------- | ------------ | | map\|{size:2} | string | uint32 | string | uint32 | string | | Item1's ID | Item1's name | Item2's ID | Item2's name | Item3's ID | Item3's name | | 1 | Apple | | | 3 | Banana | @@ -764,6 +818,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -819,7 +879,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | D | Prop1ID | | Prop1Value | Prop2ID | | Prop2Value | -|:------------------|:-----------------|:-------------|:--------------|:-----------|:-------------|:--------------| +| :---------------- | :--------------- | :----------- | :------------ | :--------- | :----------- | :------------ | | map | map | | int32 | int32 | | int32 | | Item's ID | Prop1’s ID | Prop1’s name | Prop1’s value | Prop2’s ID | Prop2’s name | Prop2’s value | | 1 | 1 | Apple | 100 | 2 | Orange | 200 | @@ -830,6 +890,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -914,8 +980,9 @@ In the metasheet `@TABLEAU`, set the `OrderedMap` option to `true`, then ordered map accessers will be generated. This feature is powered by [tableauio/loader](https://github.com/tableauio/loader). Currently supported programming languages are: - [x] C++ -- [ ] Golang +- [x] Go - [ ] C# +- [ ] JS/TS #### Example @@ -927,7 +994,7 @@ If we want `ItemConf` to generate ordered map accessers, then set {{< sheet colored >}} | ID | Name | -|-------------------|-------------| +| ----------------- | ----------- | | map | string | | Item's ID | Item's Name | | 1 | Apple | @@ -939,7 +1006,7 @@ If we want `ItemConf` to generate ordered map accessers, then set {{< sheet >}} | Sheet | OrderedMap | -|----------|------------| +| -------- | ---------- | | ItemConf | true | {{< /sheet >}} diff --git a/content/en/docs/excel/scalar.md b/content/en/docs/excel/scalar.md index 062a647a..30fd85a4 100644 --- a/content/en/docs/excel/scalar.md +++ b/content/en/docs/excel/scalar.md @@ -19,7 +19,7 @@ A worksheet `Apple` in *HelloWorld.xlsx*: {{< sheet colored>}} | ID | Name | Desc | -|-----------|-------------|----------------------------| +| --------- | ----------- | -------------------------- | | uint32 | string | string | | Item's ID | Item's Name | Item's Description | | 1 | Apple | A kind of delicious fruit. | @@ -28,6 +28,12 @@ A worksheet `Apple` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} diff --git a/content/en/docs/excel/struct-in-list.md b/content/en/docs/excel/struct-in-list.md index 586cfc77..e93acbed 100644 --- a/content/en/docs/excel/struct-in-list.md +++ b/content/en/docs/excel/struct-in-list.md @@ -21,7 +21,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Name | PropID | PropValue | -|--------------|-------------|-------------|--------------| +| ------------ | ----------- | ----------- | ------------ | | [Item]uint32 | string | {Prop}int32 | int64 | | Item's ID | Item's name | Prop's ID | Prop's value | | 1 | Apple | 1 | 10 | @@ -32,6 +32,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -103,7 +109,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Name | PropID | -|--------------|-------------|----------------------------| +| ------------ | ----------- | -------------------------- | | [Item]uint32 | string | {int32 ID,int64 Value}Prop | | Item's ID | Item's name | Prop's ID | | 1 | Apple | 1,100 | @@ -114,6 +120,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -187,7 +199,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | Reward1ItemID | Reward1ItemNum | Reward1Name | Reward2ItemID | Reward2ItemNum | Reward2Name | -|---------------------|----------------|---------------|---------------|----------------|---------------| +| ------------------- | -------------- | ------------- | ------------- | -------------- | ------------- | | [Reward]{Item}int32 | int32 | string | int32 | int32 | string | | Item1's ID | Item1's num | Reward's name | Item1's ID | Item1's num | Reward's name | | 1 | 10 | Lotto | 10 | 100 | Super Lotto | @@ -196,6 +208,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -268,7 +286,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | Reward1ItemID | Reward1ItemNum | Reward1Name | Reward2ItemID | Reward2ItemNum | Reward2Name | -|----------------------|----------------|---------------|---------------|----------------|---------------| +| -------------------- | -------------- | ------------- | ------------- | -------------- | ------------- | | [Reward]{.Item}int32 | int32 | string | int32 | int32 | string | | Item1's ID | Item1's num | Reward's name | Item1's ID | Item1's num | Reward's name | | 1 | 10 | Lotto | 10 | 100 | Super Lotto | @@ -277,6 +295,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -337,7 +361,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | Reward1Item | Reward1Name | Reward2Item | Reward2Name | -|-----------------------------------|---------------|----------------|---------------| +| --------------------------------- | ------------- | -------------- | ------------- | | [Reward]{int32 ID, int32 Num}Item | string | Item | string | | Reward1's item | Reward's name | Reward2's item | Reward's name | | 1,10 | Lotto | 2,20 | Super Lotto | @@ -346,6 +370,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} diff --git a/content/en/docs/excel/struct-in-map.md b/content/en/docs/excel/struct-in-map.md index 825d2b2d..1c4ed197 100644 --- a/content/en/docs/excel/struct-in-map.md +++ b/content/en/docs/excel/struct-in-map.md @@ -21,7 +21,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | ItemID | ItemNum | -|--------------------|-------------|------------| +| ------------------ | ----------- | ---------- | | map | {Item}int32 | int32 | | Reward's ID | Item's ID | Item's Num | | 1 | 1 | 10 | @@ -32,6 +32,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -108,7 +114,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | ItemID | ItemNum | -|--------------------|--------------|------------| +| ------------------ | ------------ | ---------- | | map | {.Item}int32 | int32 | | Reward's ID | Item's ID | Item's Num | | 1 | 1 | 10 | @@ -119,6 +125,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -183,7 +195,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Item | -|--------------------|---------------------------| +| ------------------ | ------------------------- | | map | {int32 ID, int32 Num}Item | | Reward's ID | Item's info | | 1 | 1,100 | @@ -194,6 +206,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} diff --git a/content/en/docs/excel/struct-in-struct.md b/content/en/docs/excel/struct-in-struct.md index 18efdd17..9214d49c 100644 --- a/content/en/docs/excel/struct-in-struct.md +++ b/content/en/docs/excel/struct-in-struct.md @@ -19,7 +19,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | RewardID | RewardItemID | RewardItemNum | -|---------------|--------------|---------------| +| ------------- | ------------ | ------------- | | {Reward}int32 | {Item}int32 | int32 | | Reward's ID | Item's ID | Item's num | | 1 | 1 | 10 | @@ -28,6 +28,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -91,7 +97,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | RewardID | RewardItemID | RewardItemNum | -|---------------|--------------|---------------| +| ------------- | ------------ | ------------- | | {Reward}int32 | {.Item}int32 | int32 | | Reward's ID | Item's ID | Item's num | | 1 | 1 | 10 | @@ -100,6 +106,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -151,7 +163,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | RewardID | RewardItem | -|---------------|---------------------------| +| ------------- | ------------------------- | | {Reward}int32 | {int32 ID, int32 Num}Item | | Reward's ID | Reward's item | | 1 | 1,100 | @@ -161,6 +173,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} diff --git a/content/en/docs/excel/struct.md b/content/en/docs/excel/struct.md index 1e384d7b..9758462b 100644 --- a/content/en/docs/excel/struct.md +++ b/content/en/docs/excel/struct.md @@ -23,7 +23,7 @@ For example, a worksheet `ItemConf` in `HelloWorld.xlsx`: {{< sheet colored >}} | PropertyID | PropertyName | PropertyDesc | -|:----------------|:----------------|:-----------------------| +| :-------------- | :-------------- | :--------------------- | | {Property}int32 | string | string | | Property's ID | Property's Name | Property's Description | | 1 | Orange | A kind of sour fruit. | @@ -32,6 +32,12 @@ For example, a worksheet `ItemConf` in `HelloWorld.xlsx`: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -92,7 +98,7 @@ For example, a worksheet `ItemConf` in `HelloWorld.xlsx`: {{< sheet colored >}} | ID | Prop | -|------------------|--------------------------------------------| +| ---------------- | ------------------------------------------ | | map | {int32 ID,string Name,string Desc}Property | | Item's ID | Item's property. | | 1 | 1,Orange,A good fruit. | @@ -103,6 +109,12 @@ For example, a worksheet `ItemConf` in `HelloWorld.xlsx`: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -191,7 +203,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | ID | Prop | -|-------------------|------------------------| +| ----------------- | ---------------------- | | map | {.Property} | | Item's ID | Item's property. | | 1 | 1,Orange,A good fruit. | @@ -202,6 +214,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -287,7 +305,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | RewardItemID | RewardItemNum | CostItemID | CostItemNum | PredefinedItemID | PredefinedItemNum | -|-------------------------|---------------|-----------------------|-------------|------------------------------|----------------------| +| ----------------------- | ------------- | --------------------- | ----------- | ---------------------------- | -------------------- | | {Item(RewardItem)}int32 | int32 | {Item(CostItem)}int32 | int32 | {.Item(PredefinedItem)}int32 | int32 | | Item's ID | Item's ID | Cost's ID | Cost's ID | Predefined item's ID | Predefined item's ID | | 1 | 100 | 2 | 200 | 10 | 20 | @@ -296,6 +314,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -376,7 +400,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet colored >}} | Transform1 | Transform2 | -|-------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------| +| ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | | {.Transform}\|{form:FORM_TEXT} | {.Transform}\|{form:FORM_JSON} | | Box's transform1 | Box's transform2 | | position:{x:1 y:2 z:3} rotation:{x:4 y:5 z:6} scale:{x:7 y:8 z:9} | {"position":{"x":1, "y":2, "z":3}, "rotation":{"x":4, "y":5, "z":6}, "scale":{"x":7, "y":8, "z":9}} | @@ -385,6 +409,12 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} diff --git a/content/en/docs/excel/union.md b/content/en/docs/excel/union.md index 8988b991..4f45e012 100644 --- a/content/en/docs/excel/union.md +++ b/content/en/docs/excel/union.md @@ -92,7 +92,7 @@ A worksheet `TaskConf` in *HelloWorld.xlsx*: {{< sheet colored>}} | ID | Target1Type | Target1Field1 | Target1Field2 | Target1Field3 | Target2Type | Target2Field1 | Target2Field2 | Target2Field3 | -|------------------|-----------------------------|------------------|------------------|---------------------|--------------------|------------------|------------------|------------------| +| ---------------- | --------------------------- | ---------------- | ---------------- | ------------------- | ------------------ | ---------------- | ---------------- | ---------------- | | map | [.Target]enum<.Target.Type> | union | union | union | enum<.Target.Type> | union | union | union | | ID | Target1's type | Target1's field1 | Target1's field2 | Target1's field3 | Target2's type | Target2's field1 | Target2's field2 | Target2's field3 | | 1 | PVP | 1 | 10 | Apple,Orange,Banana | PVE | 1,100,999 | 1,2,3 | 1:10,2:20,3:30 | @@ -102,6 +102,12 @@ A worksheet `TaskConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -314,7 +320,7 @@ A worksheet `TaskConf` in *HelloWorld.xlsx*: {{< sheet colored>}} | ID | TargetType | TargetField1 | TargetField2 | TargetField3 | Progress | -|------------------|-----------------------------|-----------------|------------------|---------------------|----------| +| ---------------- | --------------------------- | --------------- | ---------------- | ------------------- | -------- | | map | {.Target}enum<.Target.Type> | union | union | union | int32 | | ID | Target's type | Target's field1 | Target's field2 | Target's field3 | Progress | | 1 | PVP | 1 | 10 | Apple,Orange,Banana | 3 | @@ -326,6 +332,12 @@ A worksheet `TaskConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} @@ -561,7 +573,7 @@ A worksheet `TaskConf` in *HelloWorld.xlsx*: {{< sheet colored>}} | ID | Target1 | Target2 | Progress | -|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------| +| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | map | {.Target}\|{form:FORM_TEXT} | {.Target}\|{form:FORM_JSON} | int32 | | ID | Target1 | Target2 | Progress | | 1 | type:TYPE_PVP pvp:{type:1 damage:10 types:FRUIT_TYPE_APPLE types:FRUIT_TYPE_ORANGE types:FRUIT_TYPE_BANANA} | {"type":"TYPE_PVP","pvp":{"type":1,"damage":"10","types":["FRUIT_TYPE_APPLE","FRUIT_TYPE_ORANGE","FRUIT_TYPE_BANANA"]}} | 3 | @@ -573,6 +585,12 @@ A worksheet `TaskConf` in *HelloWorld.xlsx*: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} diff --git a/content/en/docs/prologue/quick-start.md b/content/en/docs/prologue/quick-start.md index 684fd511..9c2d97d5 100644 --- a/content/en/docs/prologue/quick-start.md +++ b/content/en/docs/prologue/quick-start.md @@ -82,7 +82,7 @@ Add **HelloWorld.xlsx** with two sheets: {{< sheet colored>}} | ID | Name | Desc | -|------------------|-------------|-------------------------------| +| ---------------- | ----------- | ----------------------------- | | map | string | string | | Item’s ID | Item’s name | Item’s description | | 1 | Apple | A kind of delicious fruit. | @@ -93,6 +93,12 @@ Add **HelloWorld.xlsx** with two sheets: {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} From 6016c584dea702a9b33bdf29ea208fdb061c7f72 Mon Sep 17 00:00:00 2001 From: wenchy Date: Wed, 25 Sep 2024 22:00:33 +0800 Subject: [PATCH 3/3] feat: add guide of excel wellknown types --- config/_default/menus/menus.en.toml | 2 +- content/en/docs/basics/enum.md | 4 +- content/en/docs/basics/naming-convention.md | 1 + content/en/docs/basics/wellknown-types.md | 6 +- content/en/docs/design/metadata.md | 4 +- content/en/docs/excel/enum.md | 52 +-- content/en/docs/excel/field-property.md | 4 +- content/en/docs/excel/infinite-nesting.md | 4 +- content/en/docs/excel/list-in-list.md | 4 +- content/en/docs/excel/list-in-map.md | 4 +- content/en/docs/excel/list.md | 6 +- content/en/docs/excel/map-in-list.md | 4 +- content/en/docs/excel/map-in-map.md | 4 +- content/en/docs/excel/map.md | 6 +- content/en/docs/excel/metasheet.md | 4 +- content/en/docs/excel/scalar.md | 4 +- content/en/docs/excel/struct-in-list.md | 4 +- content/en/docs/excel/struct-in-map.md | 4 +- content/en/docs/excel/struct-in-struct.md | 4 +- content/en/docs/excel/struct.md | 63 ++- content/en/docs/excel/union.md | 351 +++++++++++++++- content/en/docs/excel/wellknown-types.md | 427 ++++++++++++++++++-- content/en/docs/yaml/union.md | 4 +- 23 files changed, 870 insertions(+), 100 deletions(-) diff --git a/config/_default/menus/menus.en.toml b/config/_default/menus/menus.en.toml index 3ee6ccb8..cc1e82e4 100644 --- a/config/_default/menus/menus.en.toml +++ b/config/_default/menus/menus.en.toml @@ -41,7 +41,7 @@ # name = "Twitter" # pre = "" # url = "https://twitter.com/getdoks" -# weight = 20 +# weight = 20 [[footer]] name = "Privacy" diff --git a/content/en/docs/basics/enum.md b/content/en/docs/basics/enum.md index 9f97c3c9..04626aba 100644 --- a/content/en/docs/basics/enum.md +++ b/content/en/docs/basics/enum.md @@ -1,7 +1,7 @@ --- title: "Enum" -description: "Enum features." -lead: "This guide demonstrates different features of enum type." +description: "Enum basics." +lead: "This guide demonstrates basics of enum type." date: 2022-02-26T13:59:39+08:00 lastmod: 2022-02-26T13:59:39+08:00 draft: false diff --git a/content/en/docs/basics/naming-convention.md b/content/en/docs/basics/naming-convention.md index 659b416d..f20c4eae 100644 --- a/content/en/docs/basics/naming-convention.md +++ b/content/en/docs/basics/naming-convention.md @@ -33,3 +33,4 @@ See [Protobuf style: enums](https://protobuf.dev/programming-guides/style/#enums | worksheet | `PascalCase` | HelloWorld | | struct (message) | `PascalCase` | HelloWorld | | field (column) | `PascalCase` | HelloWorld | +{.table-striped} diff --git a/content/en/docs/basics/wellknown-types.md b/content/en/docs/basics/wellknown-types.md index a47bd099..341c5e48 100644 --- a/content/en/docs/basics/wellknown-types.md +++ b/content/en/docs/basics/wellknown-types.md @@ -66,9 +66,9 @@ message Fraction { A comparator holds a `sign` and a fraction `value`. Any number or fraction can compare with it. -| Type | Default | Description | -| ------------ | ------- | -------------------------------------------------------------------------------------- | -| `comparator` | `==0` | Format: ``.
e.g.: `==10`, `!=1/2`, `<10%` `<=10‰`, `>10%`, `>=10‱` | +| Type | Default | Description | +| ------------ | ------- | --------------------------------------------------------------------------------------- | +| `comparator` | `==0` | Format: ``.
e.g.: `==10`, `!=1/2`, `<10%`, `<=10‰`, `>10%`, `>=10‱` | ```protobuf message Comparator { diff --git a/content/en/docs/design/metadata.md b/content/en/docs/design/metadata.md index d322912f..e1207ee6 100644 --- a/content/en/docs/design/metadata.md +++ b/content/en/docs/design/metadata.md @@ -1,7 +1,7 @@ --- title: "Metadata" -description: "We create an IDL called Protoconf to describe Excel's structure(metadata), based on Protobuf (proto3)." -lead: "We create an IDL called Protoconf to describe Excel's structure(metadata), based on Protobuf (proto3)." +description: "An IDL called Protoconf to describe config's structure (metadata), based on Protobuf." +lead: "An IDL called Protoconf to describe config's structure (metadata), based on Protobuf." date: 2022-01-09T19:39:57+08:00 lastmod: 2022-01-09T19:39:57+08:00 draft: false diff --git a/content/en/docs/excel/enum.md b/content/en/docs/excel/enum.md index aa35b87f..f2010b71 100644 --- a/content/en/docs/excel/enum.md +++ b/content/en/docs/excel/enum.md @@ -1,7 +1,7 @@ --- title: "Enum" -description: "Enum features." -lead: "This guide demonstrates different features of Enum type." +description: "Excel enum guide." +lead: "This guide demonstrates different features of excel enum type." date: 2024-09-24T14:00:00+08:00 lastmod: 2024-09-24T14:00:00+08:00 draft: false @@ -55,7 +55,7 @@ A worksheet `ItemConf` in *HelloWorld.xlsx*: Generated: -{{< details "hello_world.proto" open >}} +{{< details "hello_world.proto" >}} ```protobuf // --snip-- @@ -100,13 +100,15 @@ message ItemConf { ## Define enum type in sheet -### Simple example +In order to generate enum type definition, you should specify `Mode` option to `MODE_ENUM_TYPE` in metasheet `@TABLEAU`. + +### Simple enum type in sheet -A worksheet `ItemType` in *HelloWorld.xlsx*: +For example, a worksheet `ItemType` in *HelloWorld.xlsx*: -{{< spreadsheet "HelloWorld.xlsx" Apple "@TABLEAU" >}} +{{< spreadsheet "HelloWorld.xlsx" ItemType "@TABLEAU" >}} -{{< sheet colored>}} +{{< sheet >}} | Name | Alias | | --------------- | ----- | @@ -118,11 +120,9 @@ A worksheet `ItemType` in *HelloWorld.xlsx*: {{< sheet >}} -| | | | -| --- | --- | --- | -| | | | -| | | | -| | | | +| Sheet | Mode | +| -------- | -------------- | +| ItemType | MODE_ENUM_TYPE | {{< /sheet >}} @@ -149,11 +149,15 @@ enum ItemType { ### Specify Number column -A worksheet `ItemType` in *HelloWorld.xlsx*: +In `Number` column, you can specify custom unique enum value number. + +{{< alert icon="ⓘ" context="info" text="If you not specify default enum value \"0\", it will be auto generated. And the default enum value name pattern is: \"{ENUM_TYPE}_INVALID\"." />}} + +For example, a worksheet `ItemType` in *HelloWorld.xlsx*: {{< spreadsheet "HelloWorld.xlsx" ItemType "@TABLEAU" >}} -{{< sheet colored>}} +{{< sheet >}} | Number | Name | Alias | | ------ | ----------------- | ------- | @@ -168,7 +172,7 @@ A worksheet `ItemType` in *HelloWorld.xlsx*: | Sheet | Mode | | -------- | -------------- | -| ItemType | MODE_TYPE_ENUM | +| ItemType | MODE_ENUM_TYPE | {{< /sheet >}} @@ -195,21 +199,21 @@ enum ItemType { ## Define and use enum type in sheet -Two worksheets `ItemType` and `ItemConf` in *HelloWorld.xlsx*: +For example, two worksheets `ItemType` and `ItemConf` in *HelloWorld.xlsx*: {{< spreadsheet "HelloWorld.xlsx" ItemType ItemConf "@TABLEAU" >}} -{{< sheet colored >}} +{{< sheet >}} -| Name | Alias | -| --------------- | ----- | -| ITEM_TYPE_FRUIT | Fruit | -| ITEM_TYPE_EQUIP | Equip | -| ITEM_TYPE_BOX | Box | +| Number | Name | Alias | +| ------ | --------------- | ----- | +| 1 | ITEM_TYPE_FRUIT | Fruit | +| 2 | ITEM_TYPE_EQUIP | Equip | +| 3 | ITEM_TYPE_BOX | Box | {{< /sheet >}} -{{< sheet >}} +{{< sheet colored >}} | ID | Type | Name | Price | | ---------------- | --------------- | ----------- | ------------ | @@ -225,7 +229,7 @@ Two worksheets `ItemType` and `ItemConf` in *HelloWorld.xlsx*: | Sheet | Mode | | -------- | -------------- | -| ItemType | MODE_TYPE_ENUM | +| ItemType | MODE_ENUM_TYPE | | ItemConf | | {{< /sheet >}} diff --git a/content/en/docs/excel/field-property.md b/content/en/docs/excel/field-property.md index fdf8f1f4..132f37e1 100644 --- a/content/en/docs/excel/field-property.md +++ b/content/en/docs/excel/field-property.md @@ -1,7 +1,7 @@ --- title: "Field property" -description: "Different properties of tableau field." -lead: "Different properties of tableau field." +description: "Tableau field property guide." +lead: "Tableau field property guide." date: 2020-10-13T15:21:01+02:00 lastmod: 2022-08-24T23:21:01+02:00 draft: false diff --git a/content/en/docs/excel/infinite-nesting.md b/content/en/docs/excel/infinite-nesting.md index caf1a842..880e8889 100644 --- a/content/en/docs/excel/infinite-nesting.md +++ b/content/en/docs/excel/infinite-nesting.md @@ -1,7 +1,7 @@ --- title: "Infinite nesting" -description: "Infinite nesting." -lead: "Infinite nesting of composite types." +description: "Excel infinite nesting guide." +lead: "Excel infinite nesting features of composite types." date: 2022-02-26T08:48:57+08:00 lastmod: 2022-02-26T08:48:57+08:00 draft: false diff --git a/content/en/docs/excel/list-in-list.md b/content/en/docs/excel/list-in-list.md index a4b533c8..6ba783c0 100644 --- a/content/en/docs/excel/list-in-list.md +++ b/content/en/docs/excel/list-in-list.md @@ -1,7 +1,7 @@ --- title: "List in list" -description: "The nesting specification of list in list." -lead: "The nesting specification of list in list." +description: "Excel list in list guide." +lead: "Excel nesting specification of list in list." date: 2022-02-26T08:48:57+08:00 lastmod: 2022-02-26T08:48:57+08:00 draft: false diff --git a/content/en/docs/excel/list-in-map.md b/content/en/docs/excel/list-in-map.md index 510286cd..e8ee1c8d 100644 --- a/content/en/docs/excel/list-in-map.md +++ b/content/en/docs/excel/list-in-map.md @@ -1,7 +1,7 @@ --- title: "List in map" -description: "The nesting specification of list in map." -lead: "The nesting specification of list in map." +description: "Excel list in map guide." +lead: "Excel nesting specification of list in map." date: 2022-02-26T08:48:57+08:00 lastmod: 2022-02-26T08:48:57+08:00 draft: false diff --git a/content/en/docs/excel/list.md b/content/en/docs/excel/list.md index 57ae4e22..6beff75b 100644 --- a/content/en/docs/excel/list.md +++ b/content/en/docs/excel/list.md @@ -1,12 +1,12 @@ --- title: "List" -description: "List features." -lead: "This guide demonstrates different features of list type." +description: "Excel list guide." +lead: "This guide demonstrates different features of excel list type." date: 2022-02-26T13:59:39+08:00 lastmod: 2022-02-26T13:59:39+08:00 draft: false images: [] -weight: 7106 +weight: 7105 toc: true --- diff --git a/content/en/docs/excel/map-in-list.md b/content/en/docs/excel/map-in-list.md index 796e23c5..53af3d2e 100644 --- a/content/en/docs/excel/map-in-list.md +++ b/content/en/docs/excel/map-in-list.md @@ -1,7 +1,7 @@ --- title: "Map in list" -description: "The nesting specification of map in list." -lead: "The nesting specification of map in list." +description: "Excel map in list guide." +lead: "Excel nesting specification of map in list." date: 2022-02-26T08:48:57+08:00 lastmod: 2022-02-26T08:48:57+08:00 draft: false diff --git a/content/en/docs/excel/map-in-map.md b/content/en/docs/excel/map-in-map.md index c08ce89c..de90ac29 100644 --- a/content/en/docs/excel/map-in-map.md +++ b/content/en/docs/excel/map-in-map.md @@ -1,7 +1,7 @@ --- title: "Map in map" -description: "The nesting specification of map in map." -lead: "The nesting specification of map in map." +description: "Excel map in map guide." +lead: "Excel nesting specification of map in map." date: 2022-02-26T08:48:57+08:00 lastmod: 2022-02-26T08:48:57+08:00 draft: false diff --git a/content/en/docs/excel/map.md b/content/en/docs/excel/map.md index 7774ce58..a0ef01be 100644 --- a/content/en/docs/excel/map.md +++ b/content/en/docs/excel/map.md @@ -1,12 +1,12 @@ --- title: "Map" -description: "Map features." -lead: "This guide demonstrates different features of map type." +description: "Excel map guide." +lead: "This guide demonstrates different features of excel map type." date: 2022-02-26T13:59:39+08:00 lastmod: 2022-02-26T13:59:39+08:00 draft: false images: [] -weight: 7107 +weight: 7106 toc: true --- diff --git a/content/en/docs/excel/metasheet.md b/content/en/docs/excel/metasheet.md index bee6a7dd..68eda4f6 100644 --- a/content/en/docs/excel/metasheet.md +++ b/content/en/docs/excel/metasheet.md @@ -1,7 +1,7 @@ --- title: "Metasheet" -description: "The metasheet is a worksheet named \"@TABLEAU\" to specify tableau parser options." -lead: "The metasheet is a worksheet named \"@TABLEAU\" to specify tableau parser options." +description: "Excel metasheet @TABLEAU guide." +lead: "The metasheet is a worksheet named \"@TABLEAU\" to specify sheet-level options of tableau parser." date: 2022-02-26T13:59:39+08:00 lastmod: 2024-09-03T13:59:39+08:00 draft: false diff --git a/content/en/docs/excel/scalar.md b/content/en/docs/excel/scalar.md index 30fd85a4..556ba03e 100644 --- a/content/en/docs/excel/scalar.md +++ b/content/en/docs/excel/scalar.md @@ -1,7 +1,7 @@ --- title: "Scalar" -description: "Scalar features." -lead: "This guide demonstrates different features of scalar type." +description: "Excel scalar guide." +lead: "This guide demonstrates different features of excel scalar type." date: 2022-09-04T13:59:39+08:00 lastmod: 2022-09-04T13:59:39+08:00 draft: false diff --git a/content/en/docs/excel/struct-in-list.md b/content/en/docs/excel/struct-in-list.md index e93acbed..b2ffa13c 100644 --- a/content/en/docs/excel/struct-in-list.md +++ b/content/en/docs/excel/struct-in-list.md @@ -1,7 +1,7 @@ --- title: "Struct in list" -description: "The nesting specification of struct in list." -lead: "The nesting specification of struct in list." +description: "Excel struct in list guide." +lead: "Excel nesting specification of struct in list." date: 2022-02-26T08:48:57+08:00 lastmod: 2022-02-26T08:48:57+08:00 draft: false diff --git a/content/en/docs/excel/struct-in-map.md b/content/en/docs/excel/struct-in-map.md index 1c4ed197..213dcb0c 100644 --- a/content/en/docs/excel/struct-in-map.md +++ b/content/en/docs/excel/struct-in-map.md @@ -1,7 +1,7 @@ --- title: "Struct in map" -description: "The nesting specification of struct in map." -lead: "The nesting specification of struct in map." +description: "Excel struct in map guide." +lead: "Excel nesting specification of struct in map." date: 2022-02-26T08:48:57+08:00 lastmod: 2022-02-26T08:48:57+08:00 draft: false diff --git a/content/en/docs/excel/struct-in-struct.md b/content/en/docs/excel/struct-in-struct.md index 9214d49c..d8130981 100644 --- a/content/en/docs/excel/struct-in-struct.md +++ b/content/en/docs/excel/struct-in-struct.md @@ -1,7 +1,7 @@ --- title: "Struct in struct" -description: "The nesting specification of struct in struct." -lead: "The nesting specification of struct in struct." +description: "Excel struct in struct guide." +lead: "Excel nesting specification of struct in struct." date: 2022-02-26T08:48:57+08:00 lastmod: 2022-02-26T08:48:57+08:00 draft: false diff --git a/content/en/docs/excel/struct.md b/content/en/docs/excel/struct.md index 9758462b..971787da 100644 --- a/content/en/docs/excel/struct.md +++ b/content/en/docs/excel/struct.md @@ -1,12 +1,12 @@ --- title: "Struct" -description: "Struct features." -lead: "This guide demonstrates different features of struct type." +description: "Excel struct guide." +lead: "This guide demonstrates different features of excel struct type." date: 2022-02-26T13:59:39+08:00 lastmod: 2022-02-26T13:59:39+08:00 draft: false images: [] -weight: 7104 +weight: 7103 toc: true --- @@ -479,3 +479,60 @@ message ItemConf { ``` {{< /details >}} + +## Define struct type in sheet + +In order to generate struct type definition, you should specify `Mode` option to `MODE_STRUCT_TYPE` in metasheet `@TABLEAU`. + +For example, a worksheet `Item` in *HelloWorld.xlsx*: + +{{< spreadsheet "HelloWorld.xlsx" Item "@TABLEAU" >}} + +{{< sheet >}} + +| Name | Type | +| --------- | ------------------------------------------------------ | +| ID | uint32 | +| Num | int32 | +| FruitType | enum<.FruitType> | +| Feature | []int32 | +| Prop | map | +| Detail | {enum<.ItemType> Type, string Name, string Desc}Detail | + +{{< /sheet >}} + +{{< sheet >}} + +| Sheet | Mode | +| ----- | ---------------- | +| Item | MODE_STRUCT_TYPE | + +{{< /sheet >}} + +{{< /spreadsheet >}} + +Generated: + +{{< details "hello_world.proto" open >}} + +```protobuf +// --snip-- +option (tableau.workbook) = {name:"HelloWorld.xlsx"}; + +// Generated from sheet: Item. +message Item { + uint32 id = 1 [(tableau.field) = {name:"ID"}]; + int32 num = 2 [(tableau.field) = {name:"Num"}]; + protoconf.FruitType fruit_type = 3 [(tableau.field) = {name:"FruitType"}]; + repeated int32 feature_list = 4 [(tableau.field) = {name:"Feature" layout:LAYOUT_INCELL}]; + map prop_map = 5 [(tableau.field) = {name:"Prop" layout:LAYOUT_INCELL}]; + Detail detail = 6 [(tableau.field) = {name:"Detail" span:SPAN_INNER_CELL}]; + message Detail { + protoconf.ItemType type = 1 [(tableau.field) = {name:"Type"}]; + string name = 2 [(tableau.field) = {name:"Name"}]; + string desc = 3 [(tableau.field) = {name:"Desc"}]; + } +} +``` + +{{< /details >}} diff --git a/content/en/docs/excel/union.md b/content/en/docs/excel/union.md index 4f45e012..b782d764 100644 --- a/content/en/docs/excel/union.md +++ b/content/en/docs/excel/union.md @@ -1,12 +1,12 @@ --- title: "Union" -description: "Union type features." -lead: "This guide demonstrates different features of union type." +description: "Excel union guide." +lead: "This guide demonstrates different features of excel union type." date: 2022-09-04T13:59:39+08:00 lastmod: 2022-09-04T13:59:39+08:00 draft: false images: [] -weight: 7105 +weight: 7104 toc: true --- @@ -35,10 +35,10 @@ message Target { option (tableau.oneof) = { field: "Field" }; - Pvp pvp = 1; // Binded to enum value 1: TYPE_PVP. - Pve pve = 2; // Binded to enum value 2: TYPE_PVP. - Story story = 3; // Binded to enum value 3: TYPE_STORY. - Skill skill = 4; // Binded to enum value 4: TYPE_SKILL. + Pvp pvp = 1; // Bound to enum value 1: TYPE_PVP. + Pve pve = 2; // Bound to enum value 2: TYPE_PVP. + Story story = 3; // Bound to enum value 3: TYPE_STORY. + Skill skill = 4; // Bound to enum value 4: TYPE_SKILL. } enum Type { @@ -344,7 +344,7 @@ A worksheet `TaskConf` in *HelloWorld.xlsx*: Generated: -{{< details "hello_world.proto" open >}} +{{< details "hello_world.proto" >}} ```protobuf // --snip-- @@ -597,7 +597,7 @@ A worksheet `TaskConf` in *HelloWorld.xlsx*: Generated: -{{< details "hello_world.proto" open >}} +{{< details "hello_world.proto" >}} ```protobuf // --snip-- @@ -768,3 +768,336 @@ message TaskConf { ``` {{< /details >}} + +## Define union type in sheet + +In order to generate union type definition, you should specify `Mode` option to `MODE_UNION_TYPE` in metasheet `@TABLEAU`. + +You can define each union field by following types: + +- [Scalar →]({{< relref "scalar" >}}) +- [Enum →]({{< relref "enum" >}}) +- [Wellknown types →]({{< relref "wellknown-types" >}}) +- [Incell struct →]({{< relref "struct/#incell-struct" >}}) +- [Incell list →]({{< relref "list/#incell-list" >}}) +- [Incell map →]({{< relref "map/#incell-map" >}}) + +### Simple union type in sheet + +For example, a worksheet `Target` in *HelloWorld.xlsx*: + +{{< spreadsheet "HelloWorld.xlsx" Target "@TABLEAU" >}} + +{{< sheet >}} + +| Name | Alias | Field1 | Field2 | Field3 | +| ----- | ---------- | ----------------------------- | ------------------------------------ | -------------------------------- | +| PVP | AliasPVP | ID
uint32
Note | Damage
int64
Note | Type
enum<.FruitType>
Note | +| PVE | AliasPVE | Hero
[]uint32
Note | Dungeon
map
Note | | +| Skill | AliasSkill | StartTime
datetime
Note | Duration
duration
Note | | + +{{< /sheet >}} + +{{< sheet >}} + +| Sheet | Mode | +| ------ | --------------- | +| Target | MODE_UNION_TYPE | + +{{< /sheet >}} + +{{< /spreadsheet >}} + +Generated: + +{{< details "hello_world.proto" open >}} + +```protobuf +// --snip-- +option (tableau.workbook) = {name:"HelloWorld.xlsx"}; + +// Generated from sheet: Target. +message Target { + option (tableau.union) = true; + + Type type = 9999 [(tableau.field) = { name: "Type" }]; + oneof value { + option (tableau.oneof) = {field: "Field"}; + + PVP pvp = 1; // Bound to enum value: TYPE_PVP. + PVE pve = 2; // Bound to enum value: TYPE_PVE. + Skill skill = 3; // Bound to enum value: TYPE_SKILL. + } + enum Type { + TYPE_INVALID = 0; + TYPE_PVP = 1 [(tableau.evalue).name = "AliasPVP"]; + TYPE_PVE = 2 [(tableau.evalue).name = "AliasPVE"]; + TYPE_SKILL = 3 [(tableau.evalue).name = "AliasSkill"]; + } + + message PVP { + uint32 id = 1 [(tableau.field) = {name:"ID"}]; + int64 damage = 2 [(tableau.field) = {name:"Damage"}]; + protoconf.FruitType type = 3 [(tableau.field) = {name:"Type"}]; + } + message PVE { + repeated uint32 hero_list = 1 [(tableau.field) = {name:"Hero" layout:LAYOUT_INCELL}]; + map dungeon_map = 2 [(tableau.field) = {name:"Dungeon" layout:LAYOUT_INCELL}]; + } + message Skill { + google.protobuf.Timestamp start_time = 1 [(tableau.field) = {name:"StartTime"}]; + google.protobuf.Duration duration = 2 [(tableau.field) = {name:"Duration"}]; + } +} +``` + +{{< /details >}} + +### Complex union type in sheet + +For example, two worksheets `Target` and `TaskConf` in *HelloWorld.xlsx*: + +{{< spreadsheet "HelloWorld.xlsx" Target TaskConf "@TABLEAU" >}} + +{{< sheet >}} + +| Name | Alias | Field1 | Field2 | Field3 | +| ----- | ---------- | ----------------------------------------------------------- | --------------------------------------------- | ----------------------------------------------------------- | +| PVP | AliasPVP | ID
uint32
Note | Damage
int64
Note | Type
[]enum<.FruitType>
Note | +| PVE | AliasPVE | Mission
{uint32 ID, enum<.ItemType> Type}Mission
Note | Hero
[]uint32
Note | Dungeon
map
Note | +| Story | AliasStory | Cost
{.Item}
Note | Fruit
map>
Note | Flavor
map, enum<.FruitType>>
Note | +| Hobby | AliasHobby | Flavor
map, enum<.FruitType>>
Note | StartTime
datetime
Note | Duration
duration
Note | +| Skill | AliasSkill | ID
uint32
Note | Damage
int64
Note | | +| Empty | AliasEmpty | | | | + +{{< /sheet >}} + +{{< sheet colored >}} + +| ID | TargetType | TargetField1 | TargetField2 | TargetField3 | Progress | +| ---------------- | --------------------------- | -------------------------- | ------------------- | -------------------------- | -------- | +| map | {.Target}enum<.Target.Type> | union | union | union | int32 | +| ID | Target's type | Target's field1 | Target's field2 | Target's field3 | Progress | +| 1 | AliasPVP | 1 | 10 | Apple,Orange,Banana | 3 | +| 2 | AliasPVE | 1,Equip | 1,2,3 | 1:10,2:20,3:30 | 10 | +| 3 | AliasStory | 1001,10 | 1:Apple,2:Orange | Fragrant:Apple,Sour:Orange | 10 | +| 4 | AliasHobby | Fragrant:Apple,Sour:Orange | 2023-06-01 10:00:00 | 22s | 12 | +| 5 | AliasSkill | 1 | 200 | | 8 | +| 6 | AliasEmpty | | | | | + +{{< /sheet >}} + +{{< sheet >}} + +| Sheet | Mode | +| ------ | --------------- | +| Target | MODE_UNION_TYPE | +| Task | | + +{{< /sheet >}} + +{{< /spreadsheet >}} + +Generated: + +{{< details "hello_world.proto" >}} + +```protobuf +// --snip-- +option (tableau.workbook) = {name:"HelloWorld.xlsx"}; + +// Generated from sheet: Target. +message Target { + option (tableau.union) = true; + + Type type = 9999 [(tableau.field) = { name: "Type" }]; + oneof value { + option (tableau.oneof) = {field: "Field"}; + + PVP pvp = 1; // Bound to enum value: TYPE_PVP. + PVE pve = 2; // Bound to enum value: TYPE_PVE. + Story story = 3; // Bound to enum value: TYPE_STORY. + Hobby hobby = 4; // Bound to enum value: TYPE_HOBBY. + Skill skill = 5; // Bound to enum value: TYPE_SKILL. + Empty empty = 6; // Bound to enum value: TYPE_EMPTY. + } + enum Type { + TYPE_INVALID = 0; + TYPE_PVP = 1 [(tableau.evalue).name = "AliasPVP"]; + TYPE_PVE = 2 [(tableau.evalue).name = "AliasPVE"]; + TYPE_STORY = 3 [(tableau.evalue).name = "AliasStory"]; + TYPE_HOBBY = 4 [(tableau.evalue).name = "AliasHobby"]; + TYPE_SKILL = 5 [(tableau.evalue).name = "AliasSkill"]; + TYPE_EMPTY = 6 [(tableau.evalue).name = "AliasEmpty"]; + } + + message PVP { + uint32 id = 1 [(tableau.field) = {name:"ID"}]; + int64 damage = 2 [(tableau.field) = {name:"Damage"}]; + repeated protoconf.FruitType type_list = 3 [(tableau.field) = {name:"Type" layout:LAYOUT_INCELL}]; + } + message PVE { + Mission mission = 1 [(tableau.field) = {name:"Mission" span:SPAN_INNER_CELL}]; + message Mission { + uint32 id = 1 [(tableau.field) = {name:"ID"}]; + protoconf.ItemType type = 2 [(tableau.field) = {name:"Type"}]; + } + repeated uint32 hero_list = 2 [(tableau.field) = {name:"Hero" layout:LAYOUT_INCELL}]; + map dungeon_map = 3 [(tableau.field) = {name:"Dungeon" layout:LAYOUT_INCELL}]; + } + message Story { + protoconf.Item cost = 1 [(tableau.field) = {name:"Cost" span:SPAN_INNER_CELL}]; + map fruit_map = 2 [(tableau.field) = {name:"Fruit" layout:LAYOUT_INCELL}]; + map flavor_map = 3 [(tableau.field) = {name:"Flavor" key:"Key" layout:LAYOUT_INCELL}]; + message Flavor { + protoconf.FruitFlavor key = 1 [(tableau.field) = {name:"Key"}]; + protoconf.FruitType value = 2 [(tableau.field) = {name:"Value"}]; + } + } + message Hobby { + map flavor_map = 1 [(tableau.field) = {name:"Flavor" key:"Key" layout:LAYOUT_INCELL}]; + message Flavor { + protoconf.FruitFlavor key = 1 [(tableau.field) = {name:"Key"}]; + protoconf.FruitType value = 2 [(tableau.field) = {name:"Value"}]; + } + google.protobuf.Timestamp start_time = 2 [(tableau.field) = {name:"StartTime"}]; + google.protobuf.Duration duration = 3 [(tableau.field) = {name:"Duration"}]; + } + message Skill { + uint32 id = 1 [(tableau.field) = {name:"ID"}]; + int64 damage = 2 [(tableau.field) = {name:"Damage"}]; + } + message Empty { + } +} + +message TaskConf { + option (tableau.worksheet) = {name:"TaskConf" namerow:1 typerow:2 noterow:3 datarow:4}; + + map task_map = 1 [(tableau.field) = {key:"ID" layout:LAYOUT_VERTICAL}]; + message Task { + int32 id = 1 [(tableau.field) = {name:"ID"}]; + protoconf.Target target = 2 [(tableau.field) = {name:"Target"}]; + int32 progress = 3 [(tableau.field) = {name:"Progress"}]; + } +} +``` + +{{< /details >}} + +{{< details "TaskConf.json" >}} + +```json +{ + "taskMap": { + "1": { + "id": 1, + "target": { + "type": "TYPE_PVP", + "pvp": { + "id": 1, + "damage": "10", + "typeList": [ + "FRUIT_TYPE_APPLE", + "FRUIT_TYPE_ORANGE", + "FRUIT_TYPE_BANANA" + ] + } + }, + "progress": 3 + }, + "2": { + "id": 2, + "target": { + "type": "TYPE_PVE", + "pve": { + "mission": { + "id": 1, + "type": "ITEM_TYPE_EQUIP" + }, + "heroList": [ + 1, + 2, + 3 + ], + "dungeonMap": { + "1": "10", + "2": "20", + "3": "30" + } + } + }, + "progress": 10 + }, + "3": { + "id": 3, + "target": { + "type": "TYPE_STORY", + "story": { + "cost": { + "id": 1001, + "num": 10 + }, + "fruitMap": { + "1": "FRUIT_TYPE_APPLE", + "2": "FRUIT_TYPE_ORANGE" + }, + "flavorMap": { + "1": { + "key": "FRUIT_FLAVOR_FRAGRANT", + "value": "FRUIT_TYPE_APPLE" + }, + "2": { + "key": "FRUIT_FLAVOR_SOUR", + "value": "FRUIT_TYPE_ORANGE" + } + } + } + }, + "progress": 10 + }, + "4": { + "id": 4, + "target": { + "type": "TYPE_HOBBY", + "hobby": { + "flavorMap": { + "1": { + "key": "FRUIT_FLAVOR_FRAGRANT", + "value": "FRUIT_TYPE_APPLE" + }, + "2": { + "key": "FRUIT_FLAVOR_SOUR", + "value": "FRUIT_TYPE_ORANGE" + } + }, + "startTime": "2023-06-01T02:00:00Z", + "duration": "22s" + } + }, + "progress": 12 + }, + "5": { + "id": 5, + "target": { + "type": "TYPE_SKILL", + "skill": { + "id": 1, + "damage": "200" + } + }, + "progress": 8 + }, + "6": { + "id": 6, + "target": { + "type": "TYPE_EMPTY", + "empty": {} + }, + "progress": 0 + } + } +} +``` + +{{< /details >}} diff --git a/content/en/docs/excel/wellknown-types.md b/content/en/docs/excel/wellknown-types.md index 2b463da1..5af4991f 100644 --- a/content/en/docs/excel/wellknown-types.md +++ b/content/en/docs/excel/wellknown-types.md @@ -1,42 +1,110 @@ --- title: "Wellknown types" -description: "Wellknown features." -lead: "This guide demonstrates different features of Wellknown types." +description: "Wellknown guide." +lead: "This guide demonstrates different features of wellknown types." date: 2024-09-24T14:00:00+08:00 lastmod: 2024-09-24T14:00:00+08:00 draft: false images: [] -weight: 7103 +weight: 7108 toc: true --- -## Scalar +## Datetime -A worksheet `Apple` in *HelloWorld.xlsx*: +### Datetime -{{< spreadsheet "HelloWorld.xlsx" Apple "@TABLEAU" >}} +> See [Basics: Datetime →]({{< relref "../basics/wellknown-types/#datetime" >}}) + +A worksheet `ItemConf` in *HelloWorld.xlsx*: + +{{< spreadsheet "HelloWorld.xlsx" ItemConf "@TABLEAU" >}} {{< sheet colored>}} -| ID | Name | Desc | -|-----------|-------------|----------------------------| -| uint32 | string | string | -| Item's ID | Item's Name | Item's Description | -| 1 | Apple | A kind of delicious fruit. | +| BeginDatetime | EndDatetime | Datetime | +| ------------------- | ------------------- | --------------------------------------- | +| datetime | datetime | []datetime | +| Begin datetime | End datetime | Datetime | +| 2020-01-01 10:25:00 | 2022-10-10 05:10:00 | 2020-01-01 10:25:00,2022-10-10 05:10:00 | {{< /sheet >}} {{< sheet >}} +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + {{< /sheet >}} {{< /spreadsheet >}} -In this worksheet, three scalar fields are defined: +Generated: + +{{< details "hello_world.proto" open >}} + +```protobuf +// --snip-- +option (tableau.workbook) = {name:"HelloWorld.xlsx"}; + +message ItemConf { + option (tableau.worksheet) = {name:"ItemConf" namerow:1 typerow:2 noterow:3 datarow:4}; + + google.protobuf.Timestamp begin_datetime = 1 [(tableau.field) = {name:"BeginDatetime"}]; + google.protobuf.Timestamp end_datetime = 2 [(tableau.field) = {name:"EndDatetime"}]; + repeated google.protobuf.Timestamp datetime_list = 3 [(tableau.field) = {name:"Datetime" layout:LAYOUT_INCELL}]; +} +``` + +{{< /details >}} + +{{< details "ItemConf.json" >}} + +```json +{ + "beginDatetime": "2020-01-01T02:25:00Z", + "endDatetime": "2022-10-09T21:10:00Z", + "datetimeList": [ + "2020-01-01T02:25:00Z", + "2022-10-09T21:10:00Z" + ] +} +``` + +{{< /details >}} + +### Date + +> See [Basics: Datetime →]({{< relref "../basics/wellknown-types/#datetime" >}}) + +A worksheet `ItemConf` in *HelloWorld.xlsx*: + +{{< spreadsheet "HelloWorld.xlsx" ItemConf "@TABLEAU" >}} + +{{< sheet colored>}} + +| BeginDate | EndDate | Date | +| ---------- | -------- | ------------------- | +| date | date | []date | +| Begin date | End date | Date | +| 2020-01-01 | 20221010 | 2020-01-01,20221010 | + +{{< /sheet >}} + +{{< sheet >}} + +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | -1. ID: `uint32` -2. Name: `string` -3. Desc: `string` +{{< /sheet >}} + +{{< /spreadsheet >}} Generated: @@ -46,29 +114,336 @@ Generated: // --snip-- option (tableau.workbook) = {name:"HelloWorld.xlsx"}; -message Apple { - option (tableau.worksheet) = {name:"Apple" namerow:1 typerow:2 noterow:3 datarow:4}; +message ItemConf { + option (tableau.worksheet) = {name:"ItemConf" namerow:1 typerow:2 noterow:3 datarow:4}; - uint32 id = 1 [(tableau.field) = {name:"ID"}]; - string name = 2 [(tableau.field) = {name:"Name"}]; - string desc = 3 [(tableau.field) = {name:"Desc"}]; + google.protobuf.Timestamp begin_date = 1 [(tableau.field) = {name:"BeginDate"}]; + google.protobuf.Timestamp end_date = 2 [(tableau.field) = {name:"EndDate"}]; + repeated google.protobuf.Timestamp date_list = 3 [(tableau.field) = {name:"Date" layout:LAYOUT_INCELL}]; } ``` {{< /details >}} -{{< details "Apple.json" >}} +{{< details "ItemConf.json" >}} ```json { - "id": 1, - "name": "Apple", - "desc": "A kind of delicious fruit." + "beginDate": "2019-12-31T16:00:00Z", + "endDate": "2022-10-09T16:00:00Z", + "dateList": [ + "2019-12-31T16:00:00Z", + "2022-10-09T16:00:00Z" + ] } ``` {{< /details >}} -### Note +### Time + +> See [Basics: Datetime →]({{< relref "../basics/wellknown-types/#datetime" >}}) + +A worksheet `ItemConf` in *HelloWorld.xlsx*: + +{{< spreadsheet "HelloWorld.xlsx" ItemConf "@TABLEAU" >}} -Scalar type is usually used to define fields of struct type. [Struct →]({{< relref "struct" >}}) +{{< sheet colored>}} + +| BeginTime | EndTime | Time | +| ---------- | -------- | ------------- | +| time | time | []time | +| Begin time | End time | Time | +| 10:25:00 | 1125 | 10:25:00,1125 | + +{{< /sheet >}} + +{{< sheet >}} + +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + +{{< /sheet >}} + +{{< /spreadsheet >}} + +Generated: + +{{< details "hello_world.proto" open >}} + +```protobuf +// --snip-- +option (tableau.workbook) = {name:"HelloWorld.xlsx"}; + +message ItemConf { + option (tableau.worksheet) = {name:"ItemConf" namerow:1 typerow:2 noterow:3 datarow:4}; + + google.protobuf.Duration begin_time = 1 [(tableau.field) = {name:"BeginTime"}]; + google.protobuf.Duration end_time = 2 [(tableau.field) = {name:"EndTime"}]; + repeated google.protobuf.Duration time_list = 3 [(tableau.field) = {name:"Time" layout:LAYOUT_INCELL}]; +} +``` + +{{< /details >}} + +{{< details "ItemConf.json" >}} + +```json +{ + "beginTime": "37500s", + "endTime": "41100s", + "timeList": [ + "37500s", + "41100s" + ] +} +``` + +{{< /details >}} + +## Duration + +> See [Basics: Duration →]({{< relref "../basics/wellknown-types/#duration" >}}) + +A worksheet `ItemConf` in *HelloWorld.xlsx*: + +{{< spreadsheet "HelloWorld.xlsx" ItemConf "@TABLEAU" >}} + +{{< sheet colored>}} + +| Duration1 | Duration2 | Duration | +| ---------- | ---------- | ---------------- | +| duration | duration | []duration | +| Duration 1 | Duration 2 | Duration | +| 1h2m3s | 4ms5us6ns | 1h2m3s,4ms5us6ns | + +{{< /sheet >}} + +{{< sheet >}} + +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + +{{< /sheet >}} + +{{< /spreadsheet >}} + +Generated: + +{{< details "hello_world.proto" open >}} + +```protobuf +// --snip-- +option (tableau.workbook) = {name:"HelloWorld.xlsx"}; + +message ItemConf { + option (tableau.worksheet) = {name:"ItemConf" namerow:1 typerow:2 noterow:3 datarow:4}; + + google.protobuf.Duration duration_1 = 1 [(tableau.field) = {name:"Duration1"}]; + google.protobuf.Duration duration_2 = 2 [(tableau.field) = {name:"Duration2"}]; + repeated google.protobuf.Duration duration_list = 3 [(tableau.field) = {name:"Duration" layout:LAYOUT_INCELL}]; +} +``` + +{{< /details >}} + +{{< details "ItemConf.json" >}} + +```json +{ + "duration1": "3723s", + "duration2": "0.004005006s", + "durationList": [ + "3723s", + "0.004005006s" + ] +} +``` + +{{< /details >}} + +## Fraction + +> See [Basics: Fraction →]({{< relref "../basics/wellknown-types/#fraction" >}}) + +A worksheet `ItemConf` in *HelloWorld.xlsx*: + +{{< spreadsheet "HelloWorld.xlsx" ItemConf "@TABLEAU" >}} + +{{< sheet colored>}} + +| MinRatio | Ratio1 | Ratio2 | Ratio3 | Ratio4 | +| --------- | ---------- | -------- | -------- | -------- | +| fraction | []fraction | fraction | fraction | fraction | +| min ratio | ratio1 | ratio 2 | ratio 3 | ratio 4 | +| 1/4 | 10% | 10‰ | 10‱ | 10 | + +{{< /sheet >}} + +{{< sheet >}} + +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + +{{< /sheet >}} + +{{< /spreadsheet >}} + +Generated: + +{{< details "hello_world.proto" open >}} + +```protobuf +// --snip-- +option (tableau.workbook) = {name:"HelloWorld.xlsx"}; + +message ItemConf { + option (tableau.worksheet) = {name:"ItemConf" namerow:1 typerow:2 noterow:3 datarow:4}; + + tableau.Fraction min_ratio = 1 [(tableau.field) = {name:"MinRatio"}]; + repeated tableau.Fraction ratio_list = 2 [(tableau.field) = {name:"Ratio" layout:LAYOUT_HORIZONTAL}]; +} +``` + +{{< /details >}} + +{{< details "ItemConf.json" >}} + +```json +{ + "minRatio": { + "num": 1, + "den": 4 + }, + "ratioList": [ + { + "num": 10, + "den": 100 + }, + { + "num": 10, + "den": 1000 + }, + { + "num": 10, + "den": 10000 + }, + { + "num": 10, + "den": 1 + } + ] +} +``` + +{{< /details >}} + +## Comparator + +> See [Basics: Comparator →]({{< relref "../basics/wellknown-types/#comparator" >}}) + +A worksheet `ItemConf` in *HelloWorld.xlsx*: + +{{< spreadsheet "HelloWorld.xlsx" ItemConf "@TABLEAU" >}} + +{{< sheet colored>}} + +| MinRatio | Ratio1 | Ratio2 | Ratio3 | Ratio4 | Ratio5 | +| ---------- | ------------ | ---------- | ---------- | ---------- | ---------- | +| comparator | []comparator | comparator | comparator | comparator | comparator | +| min ratio | ratio1 | ratio 2 | ratio 3 | ratio 4 | ratio 5 | +| !=1/4 | <10% | <=10‰ | >10‱ | >=10 | ==3/5 | + +{{< /sheet >}} + +{{< sheet >}} + +| | | | +| --- | --- | --- | +| | | | +| | | | +| | | | + +{{< /sheet >}} + +{{< /spreadsheet >}} + +Generated: + +{{< details "hello_world.proto" open >}} + +```protobuf +// --snip-- +option (tableau.workbook) = {name:"HelloWorld.xlsx"}; + +message ItemConf { + option (tableau.worksheet) = {name:"ItemConf" namerow:1 typerow:2 noterow:3 datarow:4}; + + tableau.Comparator min_ratio = 1 [(tableau.field) = {name:"MinRatio"}]; + repeated tableau.Comparator ratio_list = 2 [(tableau.field) = {name:"Ratio" layout:LAYOUT_HORIZONTAL}]; +} +``` + +{{< /details >}} + +{{< details "ItemConf.json" >}} + +```json +{ + "minRatio": { + "sign": "SIGN_NOT_EQUAL", + "value": { + "num": 1, + "den": 4 + } + }, + "ratioList": [ + { + "sign": "SIGN_LESS", + "value": { + "num": 10, + "den": 100 + } + }, + { + "sign": "SIGN_LESS_OR_EQUAL", + "value": { + "num": 10, + "den": 1000 + } + }, + { + "sign": "SIGN_GREATER", + "value": { + "num": 10, + "den": 10000 + } + }, + { + "sign": "SIGN_GREATER_OR_EQUAL", + "value": { + "num": 10, + "den": 1 + } + }, + { + "sign": "SIGN_EQUAL", + "value": { + "num": 3, + "den": 5 + } + } + ] +} +``` + +{{< /details >}} diff --git a/content/en/docs/yaml/union.md b/content/en/docs/yaml/union.md index a294841b..13381487 100644 --- a/content/en/docs/yaml/union.md +++ b/content/en/docs/yaml/union.md @@ -1,7 +1,7 @@ --- title: "Union" -description: "yaml union guide." -lead: "yaml union guide." +description: "YAML union guide." +lead: "YAML union guide." date: 2024-09-02T19:21:01+08:00 lastmod: 2024-09-02T19:21:01+08:00 draft: false