mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-25 05:58:45 +00:00
fix: increase performance of ListUser by login name ignore case (#12350)
# Which Problems Are Solved Login v2 uses the `users.v2.ListUsers`-endpoint to get a user by login name. This query had an inefficient `WHERE`-clause. # How the Problems Are Solved Update the view and use a specific clause for this query. # Additional information Added in https://github.com/zitadel/zitadel/pull/10475 --------- Co-authored-by: Marco A. <[email protected]> Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
co-authored by
Marco A.
Livio Spring
parent
561da54ff7
commit
f9995ee39c
@@ -70,6 +70,8 @@ type InitColumn struct {
|
||||
nullable bool
|
||||
defaultValue interface{}
|
||||
deleteCascade string
|
||||
generated string
|
||||
isStored bool
|
||||
}
|
||||
|
||||
type ColumnOption func(*InitColumn)
|
||||
@@ -105,6 +107,13 @@ func DeleteCascade(column string) ColumnOption {
|
||||
}
|
||||
}
|
||||
|
||||
func Generated(stmt string, isStored bool) ColumnOption {
|
||||
return func(c *InitColumn) {
|
||||
c.generated = stmt
|
||||
c.isStored = isStored
|
||||
}
|
||||
}
|
||||
|
||||
type PrimaryKey []string
|
||||
|
||||
func NewPrimaryKey(columnNames ...string) PrimaryKey {
|
||||
@@ -381,6 +390,12 @@ func createColumnsStatement(cols []*InitColumn, tableName string) string {
|
||||
if col.defaultValue != nil {
|
||||
column += " DEFAULT " + defaultValue(col.defaultValue)
|
||||
}
|
||||
if col.generated != "" {
|
||||
column += " GENERATED ALWAYS AS (" + col.generated + ")"
|
||||
if col.isStored {
|
||||
column += " STORED"
|
||||
}
|
||||
}
|
||||
if len(col.deleteCascade) != 0 {
|
||||
column += fmt.Sprintf(" REFERENCES %s (%s) ON DELETE CASCADE", tableName, col.deleteCascade)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user