Teo schema supports constants. Use the 'let' keyword to declare a constant.

let constant = "Hello, world!" // a string constant
let int = 5 // an int constant

Type annotation

Teo's constant can be type annotated. This is useful when the literal cannot figure out its correct value type.

let int32: Int32 = 5 // a int32 constant
let male: Sex = .male // a enum constant of Sex type

Use constant in arguments

When specify arguments such as decorator arguments and pipeline item arguments, constant can be used to reduce code duplication.

let length = 20
model User {
  id: Int
  @index(length: length)
  name: String