fix(user): add search query for login name (#4173)

* fix(user): add search query for login name

* fix(user): change login name query to IN from EXISTS

* fix(loginname): include InQuery into ListQuery with SubSelect as possible datasource

* fix(user): apply suggestions from code review

Co-authored-by: Livio Spring <livio.a@gmail.com>

* fix: correct unit test for search query

Co-authored-by: Fabi <38692350+hifabienne@users.noreply.github.com>
Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
Stefan Benz
2022-10-31 13:03:23 +00:00
committed by GitHub
parent 92eeb68be9
commit 5d17da542d
10 changed files with 801 additions and 22 deletions

View File

@@ -6,7 +6,7 @@ import (
"github.com/zitadel/zitadel/internal/errors"
)
//SearchQuery defines the which and how data are queried
// SearchQuery defines the which and how data are queried
type SearchQuery struct {
Columns Columns
Limit uint64
@@ -15,7 +15,7 @@ type SearchQuery struct {
Tx *sql.Tx
}
//Columns defines which fields of the event are needed for the query
// Columns defines which fields of the event are needed for the query
type Columns int32
const (
@@ -36,14 +36,14 @@ func (c Columns) Validate() error {
return nil
}
//Filter represents all fields needed to compare a field of an event with a value
// Filter represents all fields needed to compare a field of an event with a value
type Filter struct {
Field Field
Value interface{}
Operation Operation
}
//Operation defines how fields are compared
// Operation defines how fields are compared
type Operation int32
const (
@@ -63,7 +63,7 @@ const (
operationCount
)
//Field is the representation of a field from the event
// Field is the representation of a field from the event
type Field int32
const (
@@ -91,7 +91,7 @@ const (
fieldCount
)
//NewFilter is used in tests. Use searchQuery.*Filter() instead
// NewFilter is used in tests. Use searchQuery.*Filter() instead
func NewFilter(field Field, value interface{}, operation Operation) *Filter {
return &Filter{
Field: field,
@@ -100,7 +100,7 @@ func NewFilter(field Field, value interface{}, operation Operation) *Filter {
}
}
//Validate checks if the fields of the filter have valid values
// Validate checks if the fields of the filter have valid values
func (f *Filter) Validate() error {
if f == nil {
return errors.ThrowPreconditionFailed(nil, "REPO-z6KcG", "filter is nil")