...
- C3.ai developer documentation
- C3.ai academy videos
- The TypeSystem Module: https://learnc3.litmos.com/course/3802349/module/7466519
- Types Overview
- C3 Types
- Type Definition
- The TypeSystem Module: https://learnc3.litmos.com/course/3802349/module/7466519
...
- py: Use the 'py' keyword to indicate this is a Python function.
- js: Use the 'js' keyword to indicate this is a JavaScript function.
Currently, these are the only two languages which the C3 AI Suite supports for native method definitions
...
- Developer Documentation
- C3.ai Academy Videos
Inheritance
- https://developer.c3.ai/docs/7.12.17/guide/guide-c3aisuite-basic/methods-home
- https://developer.c3.ai/docs/7.12.17/guide/guide-c3aisuite-basic/defining-methods
- https://developer.c3.ai/docs/7.12.17/guide/guide-c3aisuite-basic/methods-implementing-methods
- https://developer.c3.ai/docs/7.12.17/guide/guide-c3aisuite-basic/methods-required-parameters
- https://developer.c3.ai/docs/7.12.17/guide/guide-c3aisuite-basic/methods-overloading-methods
- https://developer.c3.ai/docs/7.12.17/guide/guide-c3aisuite-basic/methods-overriding-methods
- https://developer.c3.ai/docs/7.12.17/guide/guide-c3aisuite-basic/methods-method-types
- https://developer.c3.ai/docs/7.12.17/guide/guide-c3aisuite-basic/methods-method-error-handling
- https://developer.c3.ai/docs/7.12.17/guide/guide-c3aisuite-basic/methods-testing-methods
- https://developer.c3.ai/docs/7.12.17/guide/guide-c3aisuite-basic/methods-debugging-methods
- C3.ai Academy Videos
- C3 Fundamentals module 'Methods': https://learnc3.litmos.com/course/3802353/module/7466559
- Methods Overview
- Declaring Methods
- Required Parameters
- Implementing Methods
- Testing Methods
- Debugging Methods
- C3 Fundamentals module 'Methods': https://learnc3.litmos.com/course/3802353/module/7466559
Inheritance
Like many modern languages, Types can also inherit fields and methods from other types in an object oriented fashion. The keywords which signal inheritance are `mixes` and `extends`. These follow the name of the new type.
Where C3 Type inheritance differs from other languages, is that these two keywords signal two different types of inheritance.
Mix-ins
This most basic type of inheritance is signaled by the 'mixes' keyword. When a type 'mixes' another type, it inherits all of the fields and methods of that type. The new type gets its own schema and table, and the user can go on to use it as they normally would.
Code Block |
---|
type ParentType {
fieldA: int
funcA: function(): ReturnType
}
type ChildType mixes ParentType {
fieldB: double
funcB: function(): ReturnType
} |
In this example, ChildType also includes the field and method defined in the parent type.
Persistable Inheritance
This second type of inheritance is signaled by the 'extends' keyword. When a type 'extends' another type, it inherits its fields and methods, but also resides in the same schema and table as the original type. In fact, a type can only extend a type which has been marked as `extendable`.
Code Block |
---|
extendable entity type ParentType schema name "PRT_TYP" {
fieldA: int
funcA: function(): ReturnType
}
entity type ChildType extends ParentType type key "CHLD" {
fieldB: double
funcB: function(): ReturnType
} |
In this example, ParentType is an extendable Persistable type stored in schema 'PRT_TYP'. ChildType extends ParentType and uses type key 'CHLD'.
Annotations
C3.ai developer resources on Annotations:
- Developer Documentation
- C3.ai Academy Videos
- C3 Fundamentals module 'TypeSystem': https://learnc3.litmos.com/course/3802349/module/7466519
- Annotations
- Db Annotations
- C3 Fundamentals module 'TypeSystem': https://learnc3.litmos.com/course/3802349/module/7466519
Examples
Look through the lightbulbAD package and find .c3typ files. Look at these to see the range of possibilities