Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Annotations

Annotations can appear before Type definitions, field declarations, and method declarations. They do a variety of things such as configure the database technology used to store that Type, mark what type of ActionRuntime should be used to run a method, Mark a field or method as deprecated or beta, Specify a timeseries treatment, and specify parameters of C3 Analytics (discussion to come soon). These are only a selection of what annotations can do.

Here, we show a couple of examples:

Code Block
  /**
   * This bulb's historical predictions.
   */
  @db(order='descending(timestamp)')
  bulbPredictions: [SmartBulbPrediction](smartBulb)

The bulbPredictions field is annotated that the database should store the bulbPredictions in descending order by timestamp.

Code Block
@ts(treatment='avg')
lumens: double

The lumens field of a type be default is now going to use the 'AVG' treatment.

C3.ai developer resources on Annotations:

...