-
-
Notifications
You must be signed in to change notification settings - Fork 0
Field
mbroersen edited this page Oct 15, 2020
·
3 revisions
import {Field} from 'jeloquent';
Field: Should be used to fill fields array of model Model constructor
creates magic getters en setters on parent model with the name of the field
constructor(name, isPrimaryKey): return Field
//single id primary key
const fields = [
new Field('id', true) // adds id to parent class adds pk to table
new Field('name') // adds name to parent class
]
//composed primary key
const fields = [
new Field('user_id', true) // is part of composed primary key
new Field('user_type', true) // is part of composed primary key
new Field('composed_data')
]
value: get value of field
value: set model table value of field