-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
526 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package postgres | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"time" | ||
) | ||
|
||
type mockRow struct { | ||
lsn string | ||
lag int64 | ||
scanFn func(args ...any) error | ||
} | ||
|
||
func (m *mockRow) Scan(args ...any) error { | ||
if m.scanFn != nil { | ||
return m.scanFn(args...) | ||
} | ||
|
||
switch arg := args[0].(type) { | ||
case *string: | ||
*arg = m.lsn | ||
case *int64: | ||
*arg = m.lag | ||
default: | ||
return fmt.Errorf("unexpected argument type in scan: %T", args[0]) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
const ( | ||
testDBName = "test-db" | ||
testSlot = "test_slot" | ||
testLSN = uint64(7773397064) | ||
testLSNStr = "1/CF54A048" | ||
) | ||
|
||
var ( | ||
errTest = errors.New("oh noes") | ||
|
||
now = time.Now() | ||
) |
Oops, something went wrong.