go.temporal.io/server@v1.23.0/common/persistence/sql/sqlplugin/sqlite/execution_maps.go (about) 1 // The MIT License 2 // 3 // Copyright (c) 2021 Datadog, Inc. 4 // 5 // Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. 6 // 7 // Copyright (c) 2020 Uber Technologies, Inc. 8 // 9 // Permission is hereby granted, free of charge, to any person obtaining a copy 10 // of this software and associated documentation files (the "Software"), to deal 11 // in the Software without restriction, including without limitation the rights 12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 // copies of the Software, and to permit persons to whom the Software is 14 // furnished to do so, subject to the following conditions: 15 // 16 // The above copyright notice and this permission notice shall be included in 17 // all copies or substantial portions of the Software. 18 // 19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 // THE SOFTWARE. 26 27 package sqlite 28 29 import ( 30 "context" 31 "database/sql" 32 "fmt" 33 "strings" 34 35 "github.com/jmoiron/sqlx" 36 37 "go.temporal.io/server/common/persistence/sql/sqlplugin" 38 ) 39 40 const ( 41 deleteMapQryTemplate = `DELETE FROM %v 42 WHERE 43 shard_id = ? AND 44 namespace_id = ? AND 45 workflow_id = ? AND 46 run_id = ?` 47 48 // %[2]v is the columns of the value struct (i.e. no primary key columns), comma separated 49 // %[3]v should be %[2]v with colons prepended. 50 // i.e. %[3]v = ",".join(":" + s for s in %[2]v) 51 // %[4]v should be %[2]v in the format of n=VALUES(n). 52 // i.e. %[4]v = ",".join(s + "=VALUES(" + s + ")" for s in %[2]v) 53 // So that this query can be used with BindNamed 54 // %[5]v should be the name of the key associated with the map 55 // e.g. for ActivityInfo it is "schedule_id" 56 setKeyInMapQryTemplate = `REPLACE INTO %[1]v 57 (shard_id, namespace_id, workflow_id, run_id, %[5]v, %[2]v) 58 VALUES 59 (:shard_id, :namespace_id, :workflow_id, :run_id, :%[5]v, %[3]v);` 60 61 // %[2]v is the name of the key 62 deleteKeyInMapQryTemplate = `DELETE FROM %[1]v 63 WHERE 64 shard_id = ? AND 65 namespace_id = ? AND 66 workflow_id = ? AND 67 run_id = ? AND 68 %[2]v IN ( ? )` 69 70 // %[1]v is the name of the table 71 // %[2]v is the name of the key 72 // %[3]v is the value columns, separated by commas 73 getMapQryTemplate = `SELECT %[2]v, %[3]v FROM %[1]v 74 WHERE 75 shard_id = ? AND 76 namespace_id = ? AND 77 workflow_id = ? AND 78 run_id = ?` 79 ) 80 81 func stringMap(a []string, f func(string) string) []string { 82 b := make([]string, len(a)) 83 for i, v := range a { 84 b[i] = f(v) 85 } 86 return b 87 } 88 89 func makeDeleteMapQry(tableName string) string { 90 return fmt.Sprintf(deleteMapQryTemplate, tableName) 91 } 92 93 func makeSetKeyInMapQry(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { 94 return fmt.Sprintf(setKeyInMapQryTemplate, 95 tableName, 96 strings.Join(nonPrimaryKeyColumns, ","), 97 strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string { 98 return ":" + x 99 }), ","), 100 strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string { 101 return x + "=" + x 102 }), ","), 103 mapKeyName) 104 } 105 106 func makeDeleteKeyInMapQry(tableName string, mapKeyName string) string { 107 return fmt.Sprintf(deleteKeyInMapQryTemplate, 108 tableName, 109 mapKeyName) 110 } 111 112 func makeGetMapQryTemplate(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { 113 return fmt.Sprintf(getMapQryTemplate, 114 tableName, 115 mapKeyName, 116 strings.Join(nonPrimaryKeyColumns, ",")) 117 } 118 119 var ( 120 // Omit shard_id, run_id, namespace_id, workflow_id, schedule_id since they're in the primary key 121 activityInfoColumns = []string{ 122 "data", 123 "data_encoding", 124 } 125 activityInfoTableName = "activity_info_maps" 126 activityInfoKey = "schedule_id" 127 128 deleteActivityInfoMapQry = makeDeleteMapQry(activityInfoTableName) 129 setKeyInActivityInfoMapQry = makeSetKeyInMapQry(activityInfoTableName, activityInfoColumns, activityInfoKey) 130 deleteKeyInActivityInfoMapQry = makeDeleteKeyInMapQry(activityInfoTableName, activityInfoKey) 131 getActivityInfoMapQry = makeGetMapQryTemplate(activityInfoTableName, activityInfoColumns, activityInfoKey) 132 ) 133 134 // ReplaceIntoActivityInfoMaps replaces one or more rows in activity_info_maps table 135 func (mdb *db) ReplaceIntoActivityInfoMaps( 136 ctx context.Context, 137 rows []sqlplugin.ActivityInfoMapsRow, 138 ) (sql.Result, error) { 139 return mdb.conn.NamedExecContext(ctx, 140 setKeyInActivityInfoMapQry, 141 rows, 142 ) 143 } 144 145 // SelectAllFromActivityInfoMaps reads all rows from activity_info_maps table 146 func (mdb *db) SelectAllFromActivityInfoMaps( 147 ctx context.Context, 148 filter sqlplugin.ActivityInfoMapsAllFilter, 149 ) ([]sqlplugin.ActivityInfoMapsRow, error) { 150 var rows []sqlplugin.ActivityInfoMapsRow 151 if err := mdb.conn.SelectContext(ctx, 152 &rows, 153 getActivityInfoMapQry, 154 filter.ShardID, 155 filter.NamespaceID, 156 filter.WorkflowID, 157 filter.RunID, 158 ); err != nil { 159 return nil, err 160 } 161 for i := 0; i < len(rows); i++ { 162 rows[i].ShardID = filter.ShardID 163 rows[i].NamespaceID = filter.NamespaceID 164 rows[i].WorkflowID = filter.WorkflowID 165 rows[i].RunID = filter.RunID 166 } 167 return rows, nil 168 } 169 170 // DeleteFromActivityInfoMaps deletes one or more rows from activity_info_maps table 171 func (mdb *db) DeleteFromActivityInfoMaps( 172 ctx context.Context, 173 filter sqlplugin.ActivityInfoMapsFilter, 174 ) (sql.Result, error) { 175 query, args, err := sqlx.In( 176 deleteKeyInActivityInfoMapQry, 177 filter.ShardID, 178 filter.NamespaceID, 179 filter.WorkflowID, 180 filter.RunID, 181 filter.ScheduleIDs, 182 ) 183 if err != nil { 184 return nil, err 185 } 186 return mdb.conn.ExecContext(ctx, 187 mdb.conn.Rebind(query), 188 args..., 189 ) 190 } 191 192 // DeleteAllFromActivityInfoMaps deletes all rows from activity_info_maps table 193 func (mdb *db) DeleteAllFromActivityInfoMaps( 194 ctx context.Context, 195 filter sqlplugin.ActivityInfoMapsAllFilter, 196 ) (sql.Result, error) { 197 return mdb.conn.ExecContext(ctx, 198 deleteActivityInfoMapQry, 199 filter.ShardID, 200 filter.NamespaceID, 201 filter.WorkflowID, 202 filter.RunID, 203 ) 204 } 205 206 var ( 207 timerInfoColumns = []string{ 208 "data", 209 "data_encoding", 210 } 211 timerInfoTableName = "timer_info_maps" 212 timerInfoKey = "timer_id" 213 214 deleteTimerInfoMapSQLQuery = makeDeleteMapQry(timerInfoTableName) 215 setKeyInTimerInfoMapSQLQuery = makeSetKeyInMapQry(timerInfoTableName, timerInfoColumns, timerInfoKey) 216 deleteKeyInTimerInfoMapSQLQuery = makeDeleteKeyInMapQry(timerInfoTableName, timerInfoKey) 217 getTimerInfoMapSQLQuery = makeGetMapQryTemplate(timerInfoTableName, timerInfoColumns, timerInfoKey) 218 ) 219 220 // ReplaceIntoTimerInfoMaps replaces one or more rows in timer_info_maps table 221 func (mdb *db) ReplaceIntoTimerInfoMaps( 222 ctx context.Context, 223 rows []sqlplugin.TimerInfoMapsRow, 224 ) (sql.Result, error) { 225 return mdb.conn.NamedExecContext(ctx, 226 setKeyInTimerInfoMapSQLQuery, 227 rows, 228 ) 229 } 230 231 // SelectAllFromTimerInfoMaps reads all rows from timer_info_maps table 232 func (mdb *db) SelectAllFromTimerInfoMaps( 233 ctx context.Context, 234 filter sqlplugin.TimerInfoMapsAllFilter, 235 ) ([]sqlplugin.TimerInfoMapsRow, error) { 236 var rows []sqlplugin.TimerInfoMapsRow 237 if err := mdb.conn.SelectContext(ctx, 238 &rows, 239 getTimerInfoMapSQLQuery, 240 filter.ShardID, 241 filter.NamespaceID, 242 filter.WorkflowID, 243 filter.RunID, 244 ); err != nil { 245 return nil, err 246 } 247 for i := 0; i < len(rows); i++ { 248 rows[i].ShardID = filter.ShardID 249 rows[i].NamespaceID = filter.NamespaceID 250 rows[i].WorkflowID = filter.WorkflowID 251 rows[i].RunID = filter.RunID 252 } 253 return rows, nil 254 } 255 256 // DeleteFromTimerInfoMaps deletes one or more rows from timer_info_maps table 257 func (mdb *db) DeleteFromTimerInfoMaps( 258 ctx context.Context, 259 filter sqlplugin.TimerInfoMapsFilter, 260 ) (sql.Result, error) { 261 query, args, err := sqlx.In( 262 deleteKeyInTimerInfoMapSQLQuery, 263 filter.ShardID, 264 filter.NamespaceID, 265 filter.WorkflowID, 266 filter.RunID, 267 filter.TimerIDs, 268 ) 269 if err != nil { 270 return nil, err 271 } 272 return mdb.conn.ExecContext(ctx, 273 mdb.conn.Rebind(query), 274 args..., 275 ) 276 } 277 278 // DeleteAllFromTimerInfoMaps deletes all rows from timer_info_maps table 279 func (mdb *db) DeleteAllFromTimerInfoMaps( 280 ctx context.Context, 281 filter sqlplugin.TimerInfoMapsAllFilter, 282 ) (sql.Result, error) { 283 return mdb.conn.ExecContext(ctx, 284 deleteTimerInfoMapSQLQuery, 285 filter.ShardID, 286 filter.NamespaceID, 287 filter.WorkflowID, 288 filter.RunID, 289 ) 290 } 291 292 var ( 293 childExecutionInfoColumns = []string{ 294 "data", 295 "data_encoding", 296 } 297 childExecutionInfoTableName = "child_execution_info_maps" 298 childExecutionInfoKey = "initiated_id" 299 300 deleteChildExecutionInfoMapQry = makeDeleteMapQry(childExecutionInfoTableName) 301 setKeyInChildExecutionInfoMapQry = makeSetKeyInMapQry(childExecutionInfoTableName, childExecutionInfoColumns, childExecutionInfoKey) 302 deleteKeyInChildExecutionInfoMapQry = makeDeleteKeyInMapQry(childExecutionInfoTableName, childExecutionInfoKey) 303 getChildExecutionInfoMapQry = makeGetMapQryTemplate(childExecutionInfoTableName, childExecutionInfoColumns, childExecutionInfoKey) 304 ) 305 306 // ReplaceIntoChildExecutionInfoMaps replaces one or more rows in child_execution_info_maps table 307 func (mdb *db) ReplaceIntoChildExecutionInfoMaps( 308 ctx context.Context, 309 rows []sqlplugin.ChildExecutionInfoMapsRow, 310 ) (sql.Result, error) { 311 return mdb.conn.NamedExecContext(ctx, 312 setKeyInChildExecutionInfoMapQry, 313 rows, 314 ) 315 } 316 317 // SelectAllFromChildExecutionInfoMaps reads all rows from child_execution_info_maps table 318 func (mdb *db) SelectAllFromChildExecutionInfoMaps( 319 ctx context.Context, 320 filter sqlplugin.ChildExecutionInfoMapsAllFilter, 321 ) ([]sqlplugin.ChildExecutionInfoMapsRow, error) { 322 var rows []sqlplugin.ChildExecutionInfoMapsRow 323 if err := mdb.conn.SelectContext(ctx, 324 &rows, 325 getChildExecutionInfoMapQry, 326 filter.ShardID, 327 filter.NamespaceID, 328 filter.WorkflowID, 329 filter.RunID, 330 ); err != nil { 331 return nil, err 332 } 333 for i := 0; i < len(rows); i++ { 334 rows[i].ShardID = filter.ShardID 335 rows[i].NamespaceID = filter.NamespaceID 336 rows[i].WorkflowID = filter.WorkflowID 337 rows[i].RunID = filter.RunID 338 } 339 return rows, nil 340 } 341 342 // DeleteFromChildExecutionInfoMaps deletes one or more rows from child_execution_info_maps table 343 func (mdb *db) DeleteFromChildExecutionInfoMaps( 344 ctx context.Context, 345 filter sqlplugin.ChildExecutionInfoMapsFilter, 346 ) (sql.Result, error) { 347 query, args, err := sqlx.In( 348 deleteKeyInChildExecutionInfoMapQry, 349 filter.ShardID, 350 filter.NamespaceID, 351 filter.WorkflowID, 352 filter.RunID, 353 filter.InitiatedIDs, 354 ) 355 if err != nil { 356 return nil, err 357 } 358 return mdb.conn.ExecContext(ctx, 359 mdb.conn.Rebind(query), 360 args..., 361 ) 362 } 363 364 // DeleteAllFromChildExecutionInfoMaps deletes all rows from child_execution_info_maps table 365 func (mdb *db) DeleteAllFromChildExecutionInfoMaps( 366 ctx context.Context, 367 filter sqlplugin.ChildExecutionInfoMapsAllFilter, 368 ) (sql.Result, error) { 369 return mdb.conn.ExecContext(ctx, 370 deleteChildExecutionInfoMapQry, 371 filter.ShardID, 372 filter.NamespaceID, 373 filter.WorkflowID, 374 filter.RunID, 375 ) 376 } 377 378 var ( 379 requestCancelInfoColumns = []string{ 380 "data", 381 "data_encoding", 382 } 383 requestCancelInfoTableName = "request_cancel_info_maps" 384 requestCancelInfoKey = "initiated_id" 385 386 deleteRequestCancelInfoMapQry = makeDeleteMapQry(requestCancelInfoTableName) 387 setKeyInRequestCancelInfoMapQry = makeSetKeyInMapQry(requestCancelInfoTableName, requestCancelInfoColumns, requestCancelInfoKey) 388 deleteKeyInRequestCancelInfoMapQry = makeDeleteKeyInMapQry(requestCancelInfoTableName, requestCancelInfoKey) 389 getRequestCancelInfoMapQry = makeGetMapQryTemplate(requestCancelInfoTableName, requestCancelInfoColumns, requestCancelInfoKey) 390 ) 391 392 // ReplaceIntoRequestCancelInfoMaps replaces one or more rows in request_cancel_info_maps table 393 func (mdb *db) ReplaceIntoRequestCancelInfoMaps( 394 ctx context.Context, 395 rows []sqlplugin.RequestCancelInfoMapsRow, 396 ) (sql.Result, error) { 397 return mdb.conn.NamedExecContext(ctx, 398 setKeyInRequestCancelInfoMapQry, 399 rows, 400 ) 401 } 402 403 // SelectAllFromRequestCancelInfoMaps reads all rows from request_cancel_info_maps table 404 func (mdb *db) SelectAllFromRequestCancelInfoMaps( 405 ctx context.Context, 406 filter sqlplugin.RequestCancelInfoMapsAllFilter, 407 ) ([]sqlplugin.RequestCancelInfoMapsRow, error) { 408 var rows []sqlplugin.RequestCancelInfoMapsRow 409 if err := mdb.conn.SelectContext(ctx, 410 &rows, getRequestCancelInfoMapQry, 411 filter.ShardID, 412 filter.NamespaceID, 413 filter.WorkflowID, 414 filter.RunID, 415 ); err != nil { 416 return nil, err 417 } 418 for i := 0; i < len(rows); i++ { 419 rows[i].ShardID = filter.ShardID 420 rows[i].NamespaceID = filter.NamespaceID 421 rows[i].WorkflowID = filter.WorkflowID 422 rows[i].RunID = filter.RunID 423 } 424 return rows, nil 425 } 426 427 // DeleteFromRequestCancelInfoMaps deletes one or more rows from request_cancel_info_maps table 428 func (mdb *db) DeleteFromRequestCancelInfoMaps( 429 ctx context.Context, 430 filter sqlplugin.RequestCancelInfoMapsFilter, 431 ) (sql.Result, error) { 432 query, args, err := sqlx.In( 433 deleteKeyInRequestCancelInfoMapQry, 434 filter.ShardID, 435 filter.NamespaceID, 436 filter.WorkflowID, 437 filter.RunID, 438 filter.InitiatedIDs, 439 ) 440 if err != nil { 441 return nil, err 442 } 443 return mdb.conn.ExecContext(ctx, 444 mdb.conn.Rebind(query), 445 args..., 446 ) 447 } 448 449 // DeleteAllFromRequestCancelInfoMaps deletes all rows from request_cancel_info_maps table 450 func (mdb *db) DeleteAllFromRequestCancelInfoMaps( 451 ctx context.Context, 452 filter sqlplugin.RequestCancelInfoMapsAllFilter, 453 ) (sql.Result, error) { 454 return mdb.conn.ExecContext(ctx, 455 deleteRequestCancelInfoMapQry, 456 filter.ShardID, 457 filter.NamespaceID, 458 filter.WorkflowID, 459 filter.RunID, 460 ) 461 } 462 463 var ( 464 signalInfoColumns = []string{ 465 "data", 466 "data_encoding", 467 } 468 signalInfoTableName = "signal_info_maps" 469 signalInfoKey = "initiated_id" 470 471 deleteSignalInfoMapQry = makeDeleteMapQry(signalInfoTableName) 472 setKeyInSignalInfoMapQry = makeSetKeyInMapQry(signalInfoTableName, signalInfoColumns, signalInfoKey) 473 deleteKeyInSignalInfoMapQry = makeDeleteKeyInMapQry(signalInfoTableName, signalInfoKey) 474 getSignalInfoMapQry = makeGetMapQryTemplate(signalInfoTableName, signalInfoColumns, signalInfoKey) 475 ) 476 477 // ReplaceIntoSignalInfoMaps replaces one or more rows in signal_info_maps table 478 func (mdb *db) ReplaceIntoSignalInfoMaps( 479 ctx context.Context, 480 rows []sqlplugin.SignalInfoMapsRow, 481 ) (sql.Result, error) { 482 return mdb.conn.NamedExecContext(ctx, 483 setKeyInSignalInfoMapQry, 484 rows, 485 ) 486 } 487 488 // SelectAllFromSignalInfoMaps reads all rows from signal_info_maps table 489 func (mdb *db) SelectAllFromSignalInfoMaps( 490 ctx context.Context, 491 filter sqlplugin.SignalInfoMapsAllFilter, 492 ) ([]sqlplugin.SignalInfoMapsRow, error) { 493 var rows []sqlplugin.SignalInfoMapsRow 494 if err := mdb.conn.SelectContext(ctx, 495 &rows, 496 getSignalInfoMapQry, 497 filter.ShardID, 498 filter.NamespaceID, 499 filter.WorkflowID, 500 filter.RunID, 501 ); err != nil { 502 return nil, err 503 } 504 for i := 0; i < len(rows); i++ { 505 rows[i].ShardID = filter.ShardID 506 rows[i].NamespaceID = filter.NamespaceID 507 rows[i].WorkflowID = filter.WorkflowID 508 rows[i].RunID = filter.RunID 509 } 510 return rows, nil 511 } 512 513 // DeleteFromSignalInfoMaps deletes one or more rows from signal_info_maps table 514 func (mdb *db) DeleteFromSignalInfoMaps( 515 ctx context.Context, 516 filter sqlplugin.SignalInfoMapsFilter, 517 ) (sql.Result, error) { 518 query, args, err := sqlx.In( 519 deleteKeyInSignalInfoMapQry, 520 filter.ShardID, 521 filter.NamespaceID, 522 filter.WorkflowID, 523 filter.RunID, 524 filter.InitiatedIDs, 525 ) 526 if err != nil { 527 return nil, err 528 } 529 return mdb.conn.ExecContext(ctx, 530 mdb.conn.Rebind(query), 531 args..., 532 ) 533 } 534 535 // DeleteAllFromSignalInfoMaps deletes all rows from signal_info_maps table 536 func (mdb *db) DeleteAllFromSignalInfoMaps( 537 ctx context.Context, 538 filter sqlplugin.SignalInfoMapsAllFilter, 539 ) (sql.Result, error) { 540 return mdb.conn.ExecContext(ctx, 541 deleteSignalInfoMapQry, 542 filter.ShardID, 543 filter.NamespaceID, 544 filter.WorkflowID, 545 filter.RunID, 546 ) 547 } 548 549 const ( 550 deleteAllSignalsRequestedSetQry = `DELETE FROM signals_requested_sets 551 WHERE 552 shard_id = ? AND 553 namespace_id = ? AND 554 workflow_id = ? AND 555 run_id = ? 556 ` 557 558 replaceSignalsRequestedSetQry = `REPLACE INTO signals_requested_sets 559 (shard_id, namespace_id, workflow_id, run_id, signal_id) VALUES 560 (:shard_id, :namespace_id, :workflow_id, :run_id, :signal_id)` 561 562 deleteSignalsRequestedSetQry = `DELETE FROM signals_requested_sets 563 WHERE 564 shard_id = ? AND 565 namespace_id = ? AND 566 workflow_id = ? AND 567 run_id = ? AND 568 signal_id IN ( ? )` 569 570 getSignalsRequestedSetQry = `SELECT signal_id FROM signals_requested_sets 571 WHERE 572 shard_id = ? AND 573 namespace_id = ? AND 574 workflow_id = ? AND 575 run_id = ?` 576 ) 577 578 // ReplaceIntoSignalsRequestedSets inserts one or more rows into signals_requested_sets table 579 func (mdb *db) ReplaceIntoSignalsRequestedSets( 580 ctx context.Context, 581 rows []sqlplugin.SignalsRequestedSetsRow, 582 ) (sql.Result, error) { 583 return mdb.conn.NamedExecContext(ctx, 584 replaceSignalsRequestedSetQry, 585 rows, 586 ) 587 588 } 589 590 // SelectAllFromSignalsRequestedSets reads all rows from signals_requested_sets table 591 func (mdb *db) SelectAllFromSignalsRequestedSets( 592 ctx context.Context, 593 filter sqlplugin.SignalsRequestedSetsAllFilter, 594 ) ([]sqlplugin.SignalsRequestedSetsRow, error) { 595 var rows []sqlplugin.SignalsRequestedSetsRow 596 if err := mdb.conn.SelectContext(ctx, 597 &rows, 598 getSignalsRequestedSetQry, 599 filter.ShardID, 600 filter.NamespaceID, 601 filter.WorkflowID, 602 filter.RunID, 603 ); err != nil { 604 return nil, err 605 } 606 for i := 0; i < len(rows); i++ { 607 rows[i].ShardID = filter.ShardID 608 rows[i].NamespaceID = filter.NamespaceID 609 rows[i].WorkflowID = filter.WorkflowID 610 rows[i].RunID = filter.RunID 611 } 612 return rows, nil 613 } 614 615 // DeleteFromSignalsRequestedSets deletes one or more rows from signals_requested_sets table 616 func (mdb *db) DeleteFromSignalsRequestedSets( 617 ctx context.Context, 618 filter sqlplugin.SignalsRequestedSetsFilter, 619 ) (sql.Result, error) { 620 query, args, err := sqlx.In( 621 deleteSignalsRequestedSetQry, 622 filter.ShardID, 623 filter.NamespaceID, 624 filter.WorkflowID, 625 filter.RunID, 626 filter.SignalIDs, 627 ) 628 if err != nil { 629 return nil, err 630 } 631 return mdb.conn.ExecContext(ctx, 632 mdb.conn.Rebind(query), 633 args..., 634 ) 635 } 636 637 // DeleteAllFromSignalsRequestedSets deletes all rows from signals_requested_sets table 638 func (mdb *db) DeleteAllFromSignalsRequestedSets( 639 ctx context.Context, 640 filter sqlplugin.SignalsRequestedSetsAllFilter, 641 ) (sql.Result, error) { 642 return mdb.conn.ExecContext(ctx, 643 deleteAllSignalsRequestedSetQry, 644 filter.ShardID, 645 filter.NamespaceID, 646 filter.WorkflowID, 647 filter.RunID, 648 ) 649 }