Struct Validation

Struct types can have validation rules. Let's define StudentReport again and put the validation rules in the struct.

type StudentReport struct {
	name string
	grade int
  grade >= 0
  grade <= 100

The validation rules are executed before insert or update statements. If there are validation errors, the insert will not be performed and Delia execution will halt with an error.

insert StudentReport { name: 'sue jones', grade: 92} //OK