2020-06-25 06:01:13 +00:00
|
|
|
package repository
|
|
|
|
|
|
|
|
import (
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/domain"
|
|
|
|
"github.com/zitadel/zitadel/internal/view/model"
|
2020-06-25 06:01:13 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type GeneralSearchRequest model.GeneralSearchRequest
|
|
|
|
type GeneralSearchQuery model.GeneralSearchQuery
|
|
|
|
type GeneralSearchKey model.GeneralSearchKey
|
|
|
|
|
|
|
|
func (req GeneralSearchRequest) GetLimit() uint64 {
|
|
|
|
return req.Limit
|
|
|
|
}
|
|
|
|
|
|
|
|
func (req GeneralSearchRequest) GetOffset() uint64 {
|
|
|
|
return req.Offset
|
|
|
|
}
|
|
|
|
|
|
|
|
func (req GeneralSearchRequest) GetSortingColumn() ColumnKey {
|
|
|
|
if req.SortingColumn == model.GeneralSearchKeyUnspecified {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return GeneralSearchKey(req.SortingColumn)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (req GeneralSearchRequest) GetAsc() bool {
|
|
|
|
return req.Asc
|
|
|
|
}
|
|
|
|
|
|
|
|
func (req GeneralSearchRequest) GetQueries() []SearchQuery {
|
|
|
|
result := make([]SearchQuery, len(req.Queries))
|
|
|
|
for i, q := range req.Queries {
|
|
|
|
result[i] = GeneralSearchQuery{Key: q.Key, Value: q.Value, Method: q.Method}
|
|
|
|
}
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
|
|
|
func (req GeneralSearchQuery) GetKey() ColumnKey {
|
|
|
|
return GeneralSearchKey(req.Key)
|
|
|
|
}
|
|
|
|
|
2021-03-01 07:48:50 +00:00
|
|
|
func (req GeneralSearchQuery) GetMethod() domain.SearchMethod {
|
2020-06-25 06:01:13 +00:00
|
|
|
return req.Method
|
|
|
|
}
|
|
|
|
|
|
|
|
func (req GeneralSearchQuery) GetValue() interface{} {
|
|
|
|
return req.Value
|
|
|
|
}
|
|
|
|
|
|
|
|
func (key GeneralSearchKey) ToColumnName() string {
|
|
|
|
return ""
|
|
|
|
}
|