Scalar(标量)
本文说明 Excel scalar 类型的各种特性。
Scalar
HelloWorld.xlsx 中的 worksheet Apple:
| ID | Name | Desc |
|---|---|---|
| uint32 | string | string |
| Item’s ID | Item’s Name | Item’s Description |
| 1 | Apple | A kind of delicious fruit. |
该 worksheet 中定义了三个 scalar 字段:
- ID:
uint32 - Name:
string - Desc:
string
生成结果:
hello_world.proto
// --snip--
option (tableau.workbook) = {name:"HelloWorld.xlsx" namerow:1 typerow:2 noterow:3 datarow:4};
message Apple {
option (tableau.worksheet) = {name:"Apple"};
uint32 id = 1 [(tableau.field) = {name:"ID"}];
string name = 2 [(tableau.field) = {name:"Name"}];
string desc = 3 [(tableau.field) = {name:"Desc"}];
}
Apple.json
{
"id": 1,
"name": "Apple",
"desc": "A kind of delicious fruit."
}
说明
Scalar 类型通常用于定义 struct 类型的字段。Struct →