Skip to content

Commit

Permalink
Add missing table cbor decoding (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
Odonno committed Jun 7, 2024
1 parent 69f7fe7 commit 8b54bfb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/library/cbor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ export function decodeCbor(data: ArrayBuffer) {
return new Duration(v.value);
case TAG_CUSTOM_DURATION:
return cborCustomDurationToDuration(v.value);
case TAG_TABLE:
return new Table(v.value);
case TAG_RECORDID:
return new RecordId(v.value[0], v.value[1]);
case TAG_GEOMETRY_POINT:
Expand Down
16 changes: 16 additions & 0 deletions tests/integration/tests/querying.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
GeometryPolygon,
RecordId,
StringRecordId,
Table,
UUID,
uuidv4,
uuidv7,
Expand Down Expand Up @@ -381,3 +382,18 @@ Deno.test("string record id", async () => {

await surreal.close();
});

Deno.test("table", async () => {
const surreal = await createSurreal();

const [output] = await surreal.query<[Table]>(
/* surql */ `RETURN type::table($table)`,
{
table: "person",
}
);

assertEquals(output.tb, "person");

await surreal.close();
});

0 comments on commit 8b54bfb

Please sign in to comment.