fix: pass the connector id when workflow database nod… (#599)
This commit is contained in:
@@ -30,6 +30,7 @@ type CustomSQLRequest struct {
|
||||
Params []SQLParam
|
||||
IsDebugRun bool
|
||||
UserID int64
|
||||
ConnectorID int64
|
||||
}
|
||||
|
||||
type Object = map[string]any
|
||||
@@ -91,6 +92,7 @@ type DeleteRequest struct {
|
||||
ConditionGroup *ConditionGroup
|
||||
IsDebugRun bool
|
||||
UserID int64
|
||||
ConnectorID int64
|
||||
}
|
||||
|
||||
type QueryRequest struct {
|
||||
@@ -101,6 +103,7 @@ type QueryRequest struct {
|
||||
OrderClauses []*OrderClause
|
||||
IsDebugRun bool
|
||||
UserID int64
|
||||
ConnectorID int64
|
||||
}
|
||||
|
||||
type OrderClause struct {
|
||||
@@ -113,6 +116,7 @@ type UpdateRequest struct {
|
||||
Fields map[string]any
|
||||
IsDebugRun bool
|
||||
UserID int64
|
||||
ConnectorID int64
|
||||
}
|
||||
|
||||
type InsertRequest struct {
|
||||
@@ -120,6 +124,7 @@ type InsertRequest struct {
|
||||
Fields map[string]any
|
||||
IsDebugRun bool
|
||||
UserID int64
|
||||
ConnectorID int64
|
||||
}
|
||||
|
||||
func GetDatabaseOperator() DatabaseOperator {
|
||||
|
||||
@@ -423,6 +423,14 @@ func getExecUserID(ctx context.Context) int64 {
|
||||
return execCtx.RootCtx.ExeCfg.Operator
|
||||
}
|
||||
|
||||
func getConnectorID(ctx context.Context) int64 {
|
||||
execCtx := execute.GetExeCtx(ctx)
|
||||
if execCtx == nil {
|
||||
panic(fmt.Errorf("unable to get exe context"))
|
||||
}
|
||||
return execCtx.RootCtx.ExeCfg.ConnectorID
|
||||
}
|
||||
|
||||
func parseToInput(input map[string]any) map[string]any {
|
||||
result := make(map[string]any, len(input))
|
||||
for key, value := range input {
|
||||
|
||||
@@ -104,6 +104,7 @@ func (c *CustomSQL) Invoke(ctx context.Context, input map[string]any) (map[strin
|
||||
DatabaseInfoID: c.databaseInfoID,
|
||||
IsDebugRun: isDebugExecute(ctx),
|
||||
UserID: getExecUserID(ctx),
|
||||
ConnectorID: getConnectorID(ctx),
|
||||
}
|
||||
|
||||
inputBytes, err := sonic.Marshal(input)
|
||||
|
||||
@@ -108,6 +108,7 @@ func (d *Delete) Invoke(ctx context.Context, in map[string]any) (map[string]any,
|
||||
ConditionGroup: conditionGroup,
|
||||
IsDebugRun: isDebugExecute(ctx),
|
||||
UserID: getExecUserID(ctx),
|
||||
ConnectorID: getConnectorID(ctx),
|
||||
}
|
||||
|
||||
response, err := d.deleter.Delete(ctx, request)
|
||||
|
||||
@@ -90,6 +90,7 @@ func (is *Insert) Invoke(ctx context.Context, input map[string]any) (map[string]
|
||||
Fields: fields,
|
||||
IsDebugRun: isDebugExecute(ctx),
|
||||
UserID: getExecUserID(ctx),
|
||||
ConnectorID: getConnectorID(ctx),
|
||||
}
|
||||
|
||||
response, err := is.inserter.Insert(ctx, req)
|
||||
|
||||
@@ -141,6 +141,7 @@ func (ds *Query) Invoke(ctx context.Context, in map[string]any) (map[string]any,
|
||||
Limit: ds.limit,
|
||||
IsDebugRun: isDebugExecute(ctx),
|
||||
UserID: getExecUserID(ctx),
|
||||
ConnectorID: getConnectorID(ctx),
|
||||
}
|
||||
|
||||
req.ConditionGroup = conditionGroup
|
||||
|
||||
@@ -123,6 +123,7 @@ func (u *Update) Invoke(ctx context.Context, in map[string]any) (map[string]any,
|
||||
Fields: fields,
|
||||
IsDebugRun: isDebugExecute(ctx),
|
||||
UserID: getExecUserID(ctx),
|
||||
ConnectorID: getConnectorID(ctx),
|
||||
}
|
||||
|
||||
response, err := u.updater.Update(ctx, req)
|
||||
|
||||
Reference in New Issue
Block a user