Decorator

Decorator is the thing begins with an at sign. It modifies the definition or behavior of the decorated item.

model User {
    @id
    id: Int
}

Available decorators are:

Decorator declaration

To declare a new decorator in the schema, use the declare syntax:

declare model decorator markSpecial(altName: String?)

Decorator implementation

Decorator requires server implementation. See:

app.main_namespace().define_model_field_decorator("markSpecial", |arguments: Arguments, model: &mut Model| {
  let altName: Option<String> = arguments.get_optional("altName")?;
  model.data.insert("altName".to_owned(), Value::from(altName));
  Ok(())
});