mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-24 16:47:47 +00:00
8bfa1a083c
* feat: get views and failed events * feat: get views and failed events * feat: get views and failed events * Update internal/view/repository/sequence.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * Update internal/view/repository/general_query.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> Co-authored-by: Livio Amstutz <livio.a@gmail.com>
66 lines
1.5 KiB
Go
66 lines
1.5 KiB
Go
package model
|
|
|
|
import (
|
|
key_model "github.com/caos/zitadel/internal/key/model"
|
|
global_model "github.com/caos/zitadel/internal/model"
|
|
"github.com/caos/zitadel/internal/view/repository"
|
|
)
|
|
|
|
type KeySearchRequest key_model.KeySearchRequest
|
|
type KeySearchQuery key_model.KeySearchQuery
|
|
type KeySearchKey key_model.KeySearchKey
|
|
|
|
func (req KeySearchRequest) GetLimit() uint64 {
|
|
return req.Limit
|
|
}
|
|
|
|
func (req KeySearchRequest) GetOffset() uint64 {
|
|
return req.Offset
|
|
}
|
|
|
|
func (req KeySearchRequest) GetSortingColumn() repository.ColumnKey {
|
|
if req.SortingColumn == key_model.KeySearchKeyUnspecified {
|
|
return nil
|
|
}
|
|
return KeySearchKey(req.SortingColumn)
|
|
}
|
|
|
|
func (req KeySearchRequest) GetAsc() bool {
|
|
return req.Asc
|
|
}
|
|
|
|
func (req KeySearchRequest) GetQueries() []repository.SearchQuery {
|
|
result := make([]repository.SearchQuery, len(req.Queries))
|
|
for i, q := range req.Queries {
|
|
result[i] = KeySearchQuery{Key: q.Key, Value: q.Value, Method: q.Method}
|
|
}
|
|
return result
|
|
}
|
|
|
|
func (req KeySearchQuery) GetKey() repository.ColumnKey {
|
|
return KeySearchKey(req.Key)
|
|
}
|
|
|
|
func (req KeySearchQuery) GetMethod() global_model.SearchMethod {
|
|
return req.Method
|
|
}
|
|
|
|
func (req KeySearchQuery) GetValue() interface{} {
|
|
return req.Value
|
|
}
|
|
|
|
func (key KeySearchKey) ToColumnName() string {
|
|
switch key_model.KeySearchKey(key) {
|
|
case key_model.KeySearchKeyID:
|
|
return KeyKeyID
|
|
case key_model.KeySearchKeyPrivate:
|
|
return KeyPrivate
|
|
case key_model.KeySearchKeyUsage:
|
|
return KeyUsage
|
|
case key_model.KeySearchKeyExpiry:
|
|
return KeyExpiry
|
|
default:
|
|
return ""
|
|
}
|
|
}
|