In this example on AdonisJS, the Post class definition includes @column sections. Can someone explain what this does? I assume it's creating multiple instances of the 'column' class within the Post class as member variables, each instance having a different name and data type. But how does this work and what is the @ symbol for?
import { column, BaseModel } from '@ioc:Adonis/Lucid/Orm'
export default class Post extends BaseModel {
@column({ isPrimary: true })
public id: number
@column()
public title: string
@column()
public description: string
}
Would the following be equivalent (without the defined data types)?
export default class Post extends BaseModel
{
constructor()
{
this.id = new column({ isPrimary: true });
this.title = new column();
this description = new column();
}
}
UPDATE:
After realizing AdonisJS is written in TypeScript, I found this, which answers the question.