Wellknown types

Wellknown types contain common types that are used throughout the Tableau ecosystem.

Overview

For easy use, Wellknown types are built-in types in Tableau. This concept is much like Protocol Buffers Well-Known Types.

You should include the proto files provided by Tableau and Protocol Buffers:

Datetime

TypeDefaultDescription
datetime0000-00-00 00:00:00Format: yyyy-MM-dd HH:mm:ss.
e.g.: 2020-01-01 05:10:00.
date0000-00-00Format: yyyy-MM-dd or yyyyMMdd.
e.g.: 2020-01-01 or 20200101.
time00:00:00Format: HH:mm:ss or HHmmss, HH:mm or HHmm.
e.g.: 05:10:00 or 051000, 05:10 or 0510.

Tips

Duration

TypeDefaultDescription
duration0sFormat 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

Fraction

A fraction represents a part of a whole or, more generally, any number of equal parts. See wiki: Fraction for more details.

TypeDefaultDescription
fraction0Format:
- 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
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.

TypeDefaultDescription
comparator==0Format: <Sign><Fraction>.
e.g.: ==10, !=1/2, <10%, <=10‰, >10%, >=10‱
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;  // >=
  }
}

Version

A version holds a version data with 3 formats: string, value interger and value list. A pattern option is required to parse the string into value interger, otherwise the default pattern 255.255.255 will be used.

TypeDefaultDescription
str""Format: <MAJOR>.<MINOR>.<PATCH>[.<OTHER>]....
e.g.: 1.0.1
val0Value interger of the version, see the conversion algorithm here.
major0Major version value, the 1st interger value of version string.
minor0Minor version value, the 2nd interger value of version string. Zero if there is no 2nd interger value in pattern.
patch0Patch version value, the 3rd interger value of version string. Zero if there is no 3rd interger value in pattern.
others[]Other version values, the 4rd or following interger values of version string. Nil if there is no 4rd or following interger values in pattern.
message Version {
  string str = 1; // Version in string form.
  uint64 val = 2; // Version in integer form.
  uint32 major = 3; // Major version number.
  uint32 minor = 4; // Minor version number.
  uint32 patch = 5; // Patch version number.
  repeated uint32 others = 6; // Other version numbers, such as build number, resource version, and so on.
}