Wellknown types

This guide demonstrates different features of wellknown types.

Datetime

Datetime

See Basics: Datetime →

A worksheet ItemConf in HelloWorld.xlsx:

BeginDatetimeEndDatetimeDatetime
datetimedatetime[]datetime
Begin datetimeEnd datetimeDatetime
2020-01-01 10:25:002022-10-10 05:10:002020-01-01 10:25:00,2022-10-10 05:10:00

Generated:

hello_world.proto
// --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}];
}
ItemConf.json
{
    "beginDatetime": "2020-01-01T02:25:00Z",
    "endDatetime": "2022-10-09T21:10:00Z",
    "datetimeList": [
        "2020-01-01T02:25:00Z",
        "2022-10-09T21:10:00Z"
    ]
}

Date

See Basics: Datetime →

A worksheet ItemConf in HelloWorld.xlsx:

BeginDateEndDateDate
datedate[]date
Begin dateEnd dateDate
2020-01-01202210102020-01-01,20221010

Generated:

hello_world.proto
// --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_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}];
}
ItemConf.json
{
    "beginDate": "2019-12-31T16:00:00Z",
    "endDate": "2022-10-09T16:00:00Z",
    "dateList": [
        "2019-12-31T16:00:00Z",
        "2022-10-09T16:00:00Z"
    ]
}

Time

See Basics: Datetime →

A worksheet ItemConf in HelloWorld.xlsx:

BeginTimeEndTimeTime
timetime[]time
Begin timeEnd timeTime
10:25:00112510:25:00,1125

Generated:

hello_world.proto
// --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}];
}
ItemConf.json
{
    "beginTime": "37500s",
    "endTime": "41100s",
    "timeList": [
        "37500s",
        "41100s"
    ]
}

Duration

See Basics: Duration →

A worksheet ItemConf in HelloWorld.xlsx:

Duration1Duration2Duration
durationduration[]duration
Duration 1Duration 2Duration
1h2m3s4ms5us6ns1h2m3s,4ms5us6ns

Generated:

hello_world.proto
// --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}];
}
ItemConf.json
{
    "duration1": "3723s",
    "duration2": "0.004005006s",
    "durationList": [
        "3723s",
        "0.004005006s"
    ]
}

Fraction

See Basics: Fraction →

A worksheet ItemConf in HelloWorld.xlsx:

MinRatioRatio1Ratio2Ratio3Ratio4
fraction[]fractionfractionfractionfraction
min ratioratio1ratio 2ratio 3ratio 4
1/410%10‰10‱10

Generated:

hello_world.proto
// --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}];
}
ItemConf.json
{
    "minRatio": {
        "num": 1,
        "den": 4
    },
    "ratioList": [
        {
            "num": 10,
            "den": 100
        },
        {
            "num": 10,
            "den": 1000
        },
        {
            "num": 10,
            "den": 10000
        },
        {
            "num": 10,
            "den": 1
        }
    ]
}

Comparator

See Basics: Comparator →

A worksheet ItemConf in HelloWorld.xlsx:

MinRatioRatio1Ratio2Ratio3Ratio4Ratio5
comparator[]comparatorcomparatorcomparatorcomparatorcomparator
min ratioratio1ratio 2ratio 3ratio 4ratio 5
!=1/4<10%<=10‰>10‱>=10==3/5

Generated:

hello_world.proto
// --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}];
}
ItemConf.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
            }
        }
    ]
}