...
- binary
- boolean
- byte
- char
- datetime
- decimal
- double
- float
- int
- json
- long int
- string
C3 Also supports certain composites of primitive types. For example, the C3 Type Mapp
is a map between values and keys. We can create a map directly in python in two ways:
- Let C3 Figure out the type for us:
c3.MappObj(value=python_obj)
The newMapp
object can be accessed through the.value
property of theMappObj
- Tell C3 exactly which types are supported with
c3.Mapp(c3.MappType.fromString("map<string,any>"), {'a': 5, 'b': [1,2,3]})
Similarly, C3 has the Arry
type which supports plain arrays. We can specify them in the same ways.
- Let C3 Figure out the type for us:
c3.ArryObj(value=python_list)
The newArry
object can be accessed through the.value
property of theArryObj
- Tell C3 exactly which types are supported with
c3.Arry(c3.ArryType.fromString('[int]'), [1,2,3,4])
In both cases, these primitive types aren't persisted. They can be used anywhere a C3 Type specifies it must have an Obj
type. (Especially useful for DynBatchJobs
or DynMapReduce
jobs for contexts).
Additional Resources
- Developer Documentation
- C3.ai Academy Videos
- The TypeSystem Module:
- Primitive Fields
- The TypeSystem Module:
...
The C3 AI Suite also supports abstract types. To define an Abstract Type, add the keyword 'abstract
' before the Type definition. Abstract Types cannot be instantiated and must mix-in to another concrete Type. This provides a great way to standardize interfaces. Here's an example:
Code Block |
---|
abstract type InteraceInterface { field1: int method1: function(double): int } |
...