Insert

The insert statement inserts a row into the database. Validation rules are run first and if any fail the insert is not performed.

If the primaryKey uses serial then a new primary key value is generated by the database. This value is available in the the _serial variable.

 type Customer struct {
  id int primaryKey
  name string
 } end

 insert Customer {id: 1, name: 'Art Chang'}
Serial key

If the primaryKey uses serial then a new primary key value is generated by the database. This value is available in the the _serial variable.

 type Customer struct {
  id int primaryKey
  name string
 } end

 insert Customer {id: 1, name: 'Art Chang'}
 let newCustomer = Customer[_serial] //read inserted record back