feat(gl): expose ledger application and grpc operations
This commit is contained in:
@@ -33,6 +33,14 @@ func (r fakeRow) Scan(dest ...any) error {
|
||||
*target = value.(int64)
|
||||
case *bool:
|
||||
*target = value.(bool)
|
||||
case *uint32:
|
||||
*target = value.(uint32)
|
||||
case *time.Time:
|
||||
*target = value.(time.Time)
|
||||
case *ledger.TransactionState:
|
||||
*target = value.(ledger.TransactionState)
|
||||
case *[]byte:
|
||||
*target = value.([]byte)
|
||||
default:
|
||||
return errors.New("unsupported scan target")
|
||||
}
|
||||
@@ -75,6 +83,7 @@ func (t *fakeTx) Rollback(context.Context) error {
|
||||
type fakeDatabase struct {
|
||||
tx *fakeTx
|
||||
directRow Row
|
||||
directRows []Row
|
||||
beginCalled bool
|
||||
}
|
||||
|
||||
@@ -83,9 +92,22 @@ func (d *fakeDatabase) Begin(context.Context) (Tx, error) {
|
||||
return d.tx, nil
|
||||
}
|
||||
|
||||
func (d *fakeDatabase) QueryRow(context.Context, string, ...any) Row { return d.directRow }
|
||||
func (d *fakeDatabase) Ping(context.Context) error { return nil }
|
||||
func (d *fakeDatabase) Close() {}
|
||||
func (d *fakeDatabase) QueryRow(context.Context, string, ...any) Row {
|
||||
if len(d.directRows) > 0 {
|
||||
row := d.directRows[0]
|
||||
d.directRows = d.directRows[1:]
|
||||
return row
|
||||
}
|
||||
return d.directRow
|
||||
}
|
||||
func (d *fakeDatabase) Query(context.Context, string, ...any) (Rows, error) {
|
||||
return nil, errors.New("unexpected query")
|
||||
}
|
||||
func (d *fakeDatabase) Exec(context.Context, string, ...any) (pgconn.CommandTag, error) {
|
||||
return pgconn.CommandTag{}, errors.New("unexpected exec")
|
||||
}
|
||||
func (d *fakeDatabase) Ping(context.Context) error { return nil }
|
||||
func (d *fakeDatabase) Close() {}
|
||||
|
||||
func TestJournalRepositoryAppendCommitsJournalEntriesAndSeal(t *testing.T) {
|
||||
journal := repositoryJournal(t)
|
||||
|
||||
Reference in New Issue
Block a user