-
-
Notifications
You must be signed in to change notification settings - Fork 404
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Effect is running?
@effect/[email protected] + @op-engineering/[email protected]
What steps can reproduce the bug?
import * as Reactivity from "@effect/experimental/Reactivity";
import * as RNSqlClient from "@effect/sql-sqlite-react-native/SqliteClient";
import * as Console from "effect/Console";
import * as Effect from "effect/Effect";
Effect.gen(function* () {
const sql = yield* RNSqlClient.make({ filename: ":memory:" });
yield* Console.log(`SELECT 123`, yield* sql`SELECT 123`);
})
.pipe(Effect.provide(Reactivity.layer), Effect.scoped, Effect.runPromise)
.catch(console.error);
What is the expected behavior?
LOG SELECT 123 [{"123": 123}]
What do you see instead?
LOG SELECT 123 []
Silent failure. No warnings. No errors.
Additional information
HYPOTHESIS: the API changed between @op-engineering/[email protected] – @op-engineering/[email protected]
"@op-engineering/op-sqlite": "7.1.0", |
PROBLEM 1:
try: () => db.execute(sql, params as Array<any>).rows?._array ?? [], |
db.execute
is async, this should bedb.executeSync
someRandomPromise.rows?._array
will always be undefined
PROBLEM 2:
(result) => result.rows?._array ?? [] |
try: () => db.execute(sql, params as Array<any>).rows?._array ?? [], |
- there is no
._array
field on.rows
- this is the correct shape:
export type QueryResult = {
insertId?: number;
rowsAffected: number;
res?: any[];
rows: Array<Record<string, Scalar>>;
// An array of intermediate results, just values without column names
rawRows?: Scalar[][];
columnNames?: string[];
/**
* Query metadata, available only for select query results
*/
metadata?: ColumnMetadata[];
};
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working