zitadel/internal/eventstore/unique_constraint.go
Silvan 5349d96ce4
fix(eventstore): sub queries (#1805)
* sub queries

* fix: tests

* add builder to tests

* new search query

* rename searchquerybuilder to builder

* remove comment from code

* test with multiple queries

* add filters test

* fix(contibute): listing

* add validate module

* fix: search queries

* remove unused event type in query

* ignore query if error in marshal

* go mod tidy

* update privacy policy query

* update queries

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
2021-07-06 13:55:57 +02:00

42 lines
993 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
)
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,
}
}