fix(queries): actions prepare funcs (#2689)

* chore(queries): test suite for prepare stmt funcs

* test(queries): prepare project funcs

* refactor: add comments

* test: simlify expected sql, added possibility to add args to expected queries

* test(queries): prepare funcs in org

* chore(backend): correct modules

* test(queries): org domain prepare funcs

* test: correct name

* refactor: file name

* refactor: add table to login policy columns

* chore(prepare_test): only add row to result if columns

* test(queries): login policy prepare funcs

* chore: add comments for configs

* test(queries): prepare idp funcs

* fix(queries): add table to password complexity policy cols

* test(queries): password complexity policy prepare funcs

* fix(queries): add table to password age policy cols

* test(queries): password age policy prepare func

* fix(queries): set cols on lockout policy

* test(queries): lockout policy prepare funs

* fix(queries): set table on privacy policy cols

* test(queries): privacy policy prepare funcs

* fix(queries): set table on org iam policy cols

* fix(queries): correct table in org iam policy cols

* test(queries): org iam policy prepare funcs

* test(queries): prepare project grant funcs

* refactor(queries): prepareProjectRoleQuery as func

* test(queries): prepare project role funcs

* test(queries): project grant check for nulls in joins

* fix(queries): allow null values in project grant

* refactor(queries): make toQuery private

* test(queries): action prepare funcs

* refactor: rename prepareFlowQuery to prepareFlowsQuery

* test: generic count only if count in cols

* refactor: remove param in prepareFlowQuery

* fix(queries): correct left joins in action flows

* test(queries): action flow prepare funcs
This commit is contained in:
Silvan
2021-11-16 14:04:22 +01:00
committed by GitHub
parent 9ddbc80e81
commit 6d94975a85
12 changed files with 955 additions and 64 deletions

View File

@@ -43,7 +43,7 @@ func (req *SearchRequest) toQuery(query sq.SelectBuilder) sq.SelectBuilder {
const sqlPlaceholder = "?"
type SearchQuery interface {
ToQuery(sq.SelectBuilder) sq.SelectBuilder
toQuery(sq.SelectBuilder) sq.SelectBuilder
}
type TextQuery struct {
@@ -72,7 +72,7 @@ func NewTextQuery(col Column, value string, compare TextComparison) (*TextQuery,
}, nil
}
func (q *TextQuery) ToQuery(query sq.SelectBuilder) sq.SelectBuilder {
func (q *TextQuery) toQuery(query sq.SelectBuilder) sq.SelectBuilder {
where, args := q.comp()
return query.Where(where, args...)
}
@@ -169,7 +169,7 @@ func NewNumberQuery(c Column, value interface{}, compare NumberComparison) (*Num
}, nil
}
func (q *NumberQuery) ToQuery(query sq.SelectBuilder) sq.SelectBuilder {
func (q *NumberQuery) toQuery(query sq.SelectBuilder) sq.SelectBuilder {
where, args := q.comp()
return query.Where(where, args...)
}
@@ -240,7 +240,7 @@ func NewListQuery(column Column, value []interface{}, compare ListComparison) (*
}, nil
}
func (q *ListQuery) ToQuery(query sq.SelectBuilder) sq.SelectBuilder {
func (q *ListQuery) toQuery(query sq.SelectBuilder) sq.SelectBuilder {
where, args := q.comp()
return query.Where(where, args...)
}
@@ -282,7 +282,7 @@ func NewBoolQuery(c Column, value bool) (*BoolQuery, error) {
}, nil
}
func (q *BoolQuery) ToQuery(query sq.SelectBuilder) sq.SelectBuilder {
func (q *BoolQuery) toQuery(query sq.SelectBuilder) sq.SelectBuilder {
where, args := q.comp()
return query.Where(where, args...)
}