test(queries): org prepare funcs (#2647)

* 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
This commit is contained in:
Silvan
2021-11-15 13:52:49 +01:00
committed by GitHub
parent f927f4af02
commit 8d4b2dcc75
5 changed files with 393 additions and 27 deletions

View File

@@ -5,7 +5,6 @@ import (
"database/sql"
"time"
"github.com/Masterminds/squirrel"
sq "github.com/Masterminds/squirrel"
"github.com/caos/zitadel/internal/domain"
@@ -89,13 +88,13 @@ func (q *Queries) GetActionsByFlowAndTriggerType(ctx context.Context, flowType d
}
func (q *Queries) GetFlowTypesOfActionID(ctx context.Context, actionID string) ([]domain.FlowType, error) {
stmt, args, err := squirrel.StatementBuilder.
stmt, args, err := sq.StatementBuilder.
Select(FlowsTriggersColumnFlowType.identifier()).
From(flowsTriggersTable.identifier()).
Where(sq.Eq{
FlowsTriggersColumnActionID.identifier(): actionID,
}).
PlaceholderFormat(squirrel.Dollar).
PlaceholderFormat(sq.Dollar).
ToSql()
if err != nil {
return nil, errors.ThrowInvalidArgument(err, "QUERY-Dh311", "Errors.Query.InvalidRequest")