Skip to content

Commit

Permalink
feat: define enum, struct, union in sheet (#19)
Browse files Browse the repository at this point in the history
* feat: define enum types in sheet, fix doc timestamp

* feat: add empty @tableau sheet

* feat: add guide of excel wellknown types
  • Loading branch information
wenchy authored Sep 25, 2024
1 parent 99a14e2 commit 25cc365
Show file tree
Hide file tree
Showing 51 changed files with 1,834 additions and 365 deletions.
2 changes: 1 addition & 1 deletion config/_default/menus/menus.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# name = "Twitter"
# pre = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-twitter\"><path d=\"M23 3a10.9 10.9 0 0 1-3.14 1.53 4.48 4.48 0 0 0-7.86 3v1A10.66 10.66 0 0 1 3 4s-4 9 5 13a11.64 11.64 0 0 1-7 2c9 5 20 0 20-11.5a4.5 4.5 0 0 0-.08-.83A7.72 7.72 0 0 0 23 3z\"></path></svg>"
# url = "https://twitter.com/getdoks"
# weight = 20
# weight = 20

[[footer]]
name = "Privacy"
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/api/_index.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/api/checker/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/api/checker/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/api/loader/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/api/loader/c++.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/api/loader/go.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/api/tableau/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/api/tableau/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/basics/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
42 changes: 21 additions & 21 deletions content/en/docs/basics/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -14,22 +14,22 @@ toc: true

### Basics

| Term | Definition |
|--------------|------------------------------------------------------------------------------------------------------|
| `Workbook` | An excel file.<br>A XML file.<br> A bundle of CSV files named with the same prefix seperated by `#`. |
| `Worksheet` | A sheet in a excel file.<br>A root node of a XML file.<br>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.<br> A bundle of CSV files named with the same prefix seperated by `#`. <br>A XML file. <br>A YAML file. |
| `Worksheet` | A sheet in a excel file. <br>A CSV file. <br>A root node of a XML file. <br>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.<br>⚠️ NOTE: each column name must be unique in a worksheet!<br>Default: `1`. |
| `Typerow` | Exact row number of column type definition at a worksheet.<br>Default: `2`. |
| `Noterow` | Exact row number of column note at a worksheet.<br>Default: `3`. |
Expand All @@ -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) |
Expand All @@ -62,7 +62,7 @@ A workbook(*HelloWorld.xlsx*) with two data worksheets(`ItemConf` and `ActivityC
{{< sheet colored>}}

| ID | Name | Type |
|-------------------|--------------|--------------|
| ----------------- | ------------ | ------------ |
| map<uint32, Item> | string | int32 |
| Item's ID. | Item's name. | Item's type. |
| 1 | item1 | 100 |
Expand All @@ -74,7 +74,7 @@ A workbook(*HelloWorld.xlsx*) with two data worksheets(`ItemConf` and `ActivityC
{{< sheet colored>}}

| ID | Name | Open |
|-----------------------|------------------|-------------------|
| --------------------- | ---------------- | ----------------- |
| map<uint32, Activity> | string | bool |
| Activity's ID. | Activity's name. | Activity is open? |
| 1 | activity1 | true |
Expand All @@ -85,11 +85,11 @@ A workbook(*HelloWorld.xlsx*) with two data worksheets(`ItemConf` and `ActivityC

{{< sheet >}}

| | | |
|---|---|---|
| | | |
| | | |
| | | |
| | | |
| --- | --- | --- |
| | | |
| | | |
| | | |

{{< /sheet >}}

Expand Down
9 changes: 5 additions & 4 deletions content/en/docs/basics/enum.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
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
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
images: []
weight: 8300
Expand Down Expand Up @@ -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.
Expand Down
72 changes: 3 additions & 69 deletions content/en/docs/basics/grammar-and-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,82 +24,16 @@ 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`. <br>e.g.: `2020-01-01 05:10:00`. |
| `date` | `0000-00-00` | Format: `yyyy-MM-dd` or `yyyyMMdd`. <br>e.g.: `2020-01-01` or `20200101`. |
| `time` | `00:00:00` | Format: `HH:mm:ss` or `HHmmss`, `HH:mm` or `HHmm`. <br>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`. <br>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: <br>- `N%`: percentage, e.g.: `10%` <br>- `N‰`: per thounsand, e.g.: `10‰` <br>- `N‱`: per ten thounsand, e.g.: `10‱`<br>- `N/D`: simple fraction, e.g.: `3/4`<br>- `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: `<Sign><Fraction>`. <br>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 |
| -------- | -------------------------------------------------- |
| `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

Expand Down
1 change: 1 addition & 0 deletions content/en/docs/basics/naming-convention.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Loading

0 comments on commit 25cc365

Please sign in to comment.