mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 07:47:32 +00:00
fix(handler): pass context to statement execution method
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
@@ -91,7 +92,7 @@ type Statement struct {
|
||||
Execute Exec
|
||||
}
|
||||
|
||||
type Exec func(ex Executer, projectionName string) error
|
||||
type Exec func(ctx context.Context, ex Executer, projectionName string) error
|
||||
|
||||
func WithTableSuffix(name string) func(*execConfig) {
|
||||
return func(o *execConfig) {
|
||||
@@ -670,7 +671,7 @@ type execConfig struct {
|
||||
type query func(config execConfig) string
|
||||
|
||||
func exec(config execConfig, q query, opts []execOption) Exec {
|
||||
return func(ex Executer, projectionName string) (err error) {
|
||||
return func(ctx context.Context, ex Executer, projectionName string) (err error) {
|
||||
if projectionName == "" {
|
||||
return ErrNoProjection
|
||||
}
|
||||
@@ -694,12 +695,12 @@ func exec(config execConfig, q query, opts []execOption) Exec {
|
||||
}
|
||||
|
||||
func multiExec(execList []Exec) Exec {
|
||||
return func(ex Executer, projectionName string) error {
|
||||
return func(ctx context.Context, ex Executer, projectionName string) error {
|
||||
for _, exec := range execList {
|
||||
if exec == nil {
|
||||
continue
|
||||
}
|
||||
if err := exec(ex, projectionName); err != nil {
|
||||
if err := exec(ctx, ex, projectionName); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user