linkahead.common.datatype module#
- linkahead.common.datatype.LIST(datatype: str | Entity | DATATYPE) str#
Return a string representing the list datatype which contains elements of
datatype.
- linkahead.common.datatype.get_id_of_datatype(datatype: str) int#
returns the id of a Record Type
This is not trivial, as queries may also return children. A check comparing names is necessary.
- Parameters:
datatype (string) – A datatype, e.g. DOUBLE, or LIST<Person>
- Return type:
The id of the RecordType with the same name as the datatype.
- Raises:
QueryNotUniqueError – If there are more than one entities with the same name as the datatype.
EmptyUniqueQueryError – If there is no entity with the name of the datatype.
- linkahead.common.datatype.get_list_datatype(datatype: str, strict: bool = False) str | None#
Returns the datatype of the elements in the list. If it not a list, return None.
- Parameters:
datatype (str) – The (list) datatype for which the inner datatype shall be returned.
strict (bool = False) – If True, raise ValueError instead of returning None in case of non-lists or mismatched types.
- linkahead.common.datatype.get_referenced_recordtype(datatype: str) str#
Return the record type of the referenced datatype.
- Raises:
ValueError – In cases where datatype is not a reference, the list does not have a referenced record type or the datatype is a FILE.
- Parameters:
datatype (str) – The datatype to check.
- Returns:
String containing the name of the referenced datatype.
- Return type:
str
- linkahead.common.datatype.is_list_datatype(datatype: str) bool#
returns whether the datatype is a list
- linkahead.common.datatype.is_reference(datatype: str) bool#
Returns whether the value is a reference
FILE and REFERENCE properties are examples, but also datatypes that are RecordTypes.
- Parameters:
datatype (str) – The datatype to check.
- Returns:
True if the datatype is a not base datatype or a list of a base datatype. Otherwise False is returned.
- Return type:
bool