Issue:
Make KV storage flow more generic

Model the KV storage flow as a series of common operations (For example, `set in redis -> get sql query -> push query to redis stream`) and define generic utilities that perform these operations for all KV-enabled storage interfaces (as opposed to rewriting code).

Resolution:
<think>
PR Context:
- Title: refactor: use generic function to push to drainer
- Merged: 2023-02-06T11:48:28Z
- Files changed: 4 files
- Commits: 6 commits

Implementation approach:
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Refactoring

## Description
<!-- Describe your changes in detail -->
Use a generic function to push sql queries into drainer stream.

## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless its an obvious bug o
</think>

To implement this, you'll need to modify:


**Detailed Implementation:**


**Commit 1:** refactor: use generic function to push to drainer (#496)
Files to modify:


**crates/router/src/db/payment_attempt.rs**
  Modify existing code

**crates/router/src/db/payment_intent.rs**
  Modify existing code

**crates/router/src/db/refund.rs**
  Modify existing code

**crates/router/src/services.rs**
  Add:
    - function: pub::push_to_drainer_stream