mirror of
https://github.com/zitadel/zitadel.git
synced 2025-04-24 12:51:31 +00:00

* 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
30 lines
714 B
Go
30 lines
714 B
Go
package repository
|
|
|
|
//UniqueCheck represents all information about a unique attribute
|
|
type UniqueConstraint struct {
|
|
//UniqueField is the field which should be unique
|
|
UniqueField string
|
|
|
|
//UniqueType is the type of the unique field
|
|
UniqueType string
|
|
|
|
//Action defines if unique constraint should be added or removed
|
|
Action UniqueConstraintAction
|
|
|
|
//ErrorMessage is the message key which should be returned if constraint is violated
|
|
ErrorMessage string
|
|
}
|
|
|
|
type UniqueConstraintAction int32
|
|
|
|
const (
|
|
UniqueConstraintAdd UniqueConstraintAction = iota
|
|
UniqueConstraintRemoved
|
|
|
|
uniqueConstraintActionCount
|
|
)
|
|
|
|
func (f UniqueConstraintAction) Valid() bool {
|
|
return f >= 0 && f < uniqueConstraintActionCount
|
|
}
|