add unknown as the first trigger event

to account for serialization errors where the field is unset by mistake
This commit is contained in:
Daniel Schmidt 2025-07-28 09:11:14 +02:00
parent 5e288f56e2
commit f72944530d
2 changed files with 11 additions and 9 deletions

View file

@ -65,7 +65,8 @@ type ActionTriggerEvent int
//go:generate go tool golang.org/x/tools/cmd/stringer -type ActionTriggerEvent
const (
BeforeCreate ActionTriggerEvent = iota
Unkonwn ActionTriggerEvent = iota
BeforeCreate
AfterCreate
BeforeUpdate
AfterUpdate

View file

@ -8,17 +8,18 @@ func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[BeforeCreate-0]
_ = x[AfterCreate-1]
_ = x[BeforeUpdate-2]
_ = x[AfterUpdate-3]
_ = x[BeforeDestroy-4]
_ = x[AfterDestroy-5]
_ = x[Unkonwn-0]
_ = x[BeforeCreate-1]
_ = x[AfterCreate-2]
_ = x[BeforeUpdate-3]
_ = x[AfterUpdate-4]
_ = x[BeforeDestroy-5]
_ = x[AfterDestroy-6]
}
const _ActionTriggerEvent_name = "BeforeCreateAfterCreateBeforeUpdateAfterUpdateBeforeDestroyAfterDestroy"
const _ActionTriggerEvent_name = "UnkonwnBeforeCreateAfterCreateBeforeUpdateAfterUpdateBeforeDestroyAfterDestroy"
var _ActionTriggerEvent_index = [...]uint8{0, 12, 23, 35, 46, 59, 71}
var _ActionTriggerEvent_index = [...]uint8{0, 7, 19, 30, 42, 53, 66, 78}
func (i ActionTriggerEvent) String() string {
if i < 0 || i >= ActionTriggerEvent(len(_ActionTriggerEvent_index)-1) {