mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-07 15:27:41 +00:00
28bfe72930
* feat: uniqueness on events * fix: some tests * fix: add unique username * fix: nice error message * fix: add unique test * fix: add unique test * fix: add unique constraint to events * fix: correct unique constraint on user events * fix: remove user constraint * fix: add unique constraints * fix: add unique constraints * fix: add unique constraints * fix: unnique constraints without interface * fix: unique idp config * fix: unique constraint comments * fix: unique constraints in one table * fix: unique constraints error * fix: fix unique constraint on create user * fix: fix unique constraint on create project * fix: fix unique constraint on idp configs
44 lines
1023 B
Go
44 lines
1023 B
Go
package eventstore
|
|
|
|
type EventUniqueConstraint struct {
|
|
// UniqueType is the table name for the unique constraint
|
|
UniqueType string
|
|
//UniqueField is the unique key
|
|
UniqueField string
|
|
//Action defines if unique constraint should be added or removed
|
|
Action UniqueConstraintAction
|
|
//ErrorMessage defines the translation file key for the error message
|
|
ErrorMessage string
|
|
}
|
|
|
|
type UniqueConstraintAction int32
|
|
|
|
const (
|
|
UniqueConstraintAdd UniqueConstraintAction = iota
|
|
UniqueConstraintRemove
|
|
|
|
uniqueConstraintActionCount
|
|
)
|
|
|
|
func NewAddEventUniqueConstraint(
|
|
uniqueType,
|
|
uniqueField,
|
|
errMessage string) *EventUniqueConstraint {
|
|
return &EventUniqueConstraint{
|
|
UniqueType: uniqueType,
|
|
UniqueField: uniqueField,
|
|
ErrorMessage: errMessage,
|
|
Action: UniqueConstraintAdd,
|
|
}
|
|
}
|
|
|
|
func NewRemoveEventUniqueConstraint(
|
|
uniqueType,
|
|
uniqueField string) *EventUniqueConstraint {
|
|
return &EventUniqueConstraint{
|
|
UniqueType: uniqueType,
|
|
UniqueField: uniqueField,
|
|
Action: UniqueConstraintRemove,
|
|
}
|
|
}
|