graviti.portex.builtin
#
The Portex builtin types.
Module Contents#
Classes#
The base class of Portex builtin type. |
|
Portex primitive type |
|
Portex primitive type |
|
Portex primitive type |
|
Portex primitive type |
|
Portex primitive type |
|
Portex primitive type |
|
Portex primitive type |
|
Portex complex type |
|
Portex complex type |
|
Portex complex type |
|
Portex temporal type |
|
Portex temporal type |
|
Portex temporal type |
|
Portex temporal type |
Attributes#
- class graviti.portex.builtin.PortexBuiltinType(nullable=False)[source]#
Bases:
graviti.portex.base.PortexType
The base class of Portex builtin type.
- Parameters
nullable (bool) –
- class graviti.portex.builtin.string(nullable=False)[source]#
Bases:
PortexBuiltinType
Portex primitive type
string
.- Parameters
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = string() >>> t string()
- class graviti.portex.builtin.binary(nullable=False)[source]#
Bases:
PortexBuiltinType
Portex primitive type
binary
.- Parameters
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = binary() >>> t binary()
- class graviti.portex.builtin.boolean(nullable=False)[source]#
Bases:
PortexBuiltinType
Portex primitive type
boolean
.- Parameters
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = boolean() >>> t boolean()
- class graviti.portex.builtin.int32(nullable=False)[source]#
Bases:
PortexBuiltinType
Portex primitive type
int32
.- Parameters
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = int32() >>> t int32()
- class graviti.portex.builtin.int64(nullable=False)[source]#
Bases:
PortexBuiltinType
Portex primitive type
int64
.- Parameters
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = int64() >>> t int64()
- class graviti.portex.builtin.float32(nullable=False)[source]#
Bases:
PortexBuiltinType
Portex primitive type
float32
.- Parameters
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = float32() >>> t float32()
- class graviti.portex.builtin.float64(nullable=False)[source]#
Bases:
PortexBuiltinType
Portex primitive type
float64
.- Parameters
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = float64() >>> t float64()
- class graviti.portex.builtin.record(fields, nullable=False)[source]#
Bases:
PortexBuiltinType
,graviti.portex.base.PortexRecordBase
Portex complex type
record
.- Parameters
fields (Union[Iterable[Tuple[str, graviti.portex.base.PortexType]], Mapping[str, graviti.portex.base.PortexType]]) – The fields of the record.
nullable (bool) – Whether it is a nullable type.
Examples
Create a record by dict:
>>> t = record({"f0": int32(), "f1": float32()}) >>> t record( fields={ 'f0': int32(), 'f1': float32(), }, )
Create a record by tuple list:
>>> t = record([("f0", string()), ("f1", enum(["v0", "v1"]))]) >>> t record( fields={ 'f0': string(), 'f1': enum( values=['v0', 'v1'], ), }, )
- class graviti.portex.builtin.enum(values, nullable=False)[source]#
Bases:
PortexBuiltinType
Portex complex type
enum
.- Parameters
values (Iterable[_E]) – The values of the enum members.
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = enum(["v0", "v1"]) >>> t enum( values=['v0', 'v1'], )
- class graviti.portex.builtin.array(items, length=None, nullable=False)[source]#
Bases:
PortexBuiltinType
Portex complex type
array
.- Parameters
items (graviti.portex.base.PortexType) – The item type of the array.
length (Optional[int]) – The length of the array.
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = array(int32(0), 100) >>> t array( items=int32( minimum=0, ), length=100, )
- class graviti.portex.builtin.date(nullable=False)[source]#
Bases:
PortexBuiltinType
Portex temporal type
date
.- Parameters
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = date() >>> t date()
- class graviti.portex.builtin.time(unit, nullable=False)[source]#
Bases:
PortexBuiltinType
Portex temporal type
time
.- Parameters
unit (str) – The unit of the time, supports ‘s’, ‘ms’, ‘us’ and ‘ns’.
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = time("ms") >>> t times( unit='ms', )
- class graviti.portex.builtin.timestamp(unit, tz=None, nullable=False)[source]#
Bases:
PortexBuiltinType
Portex temporal type
timestamp
.- Parameters
unit (str) – The unit of the timestamp, supports ‘s’, ‘ms’, ‘us’ and ‘ns’.
tz (Optional[str]) – The name of the timezone,
None
indicates the timestamp is naive.nullable (bool) – Whether it is a nullable type.
Examples
>>> t = timestamp("ms") >>> t timestamp( unit='ms', ) >>> >>> t = timestamp("us", tz="UTC") >>> t timestamp( unit='ms', tz='UTC', )
- class graviti.portex.builtin.timedelta(unit, nullable=False)[source]#
Bases:
PortexBuiltinType
Portex temporal type
timedelta
.- Parameters
unit (str) – The unit of the timedelta, supports ‘s’, ‘ms’, ‘us’ and ‘ns’.
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = timedelta("ms") >>> t timedelta( unit='ms', )