Skip to content

Commit

Permalink
chore: add back drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
yonadaa committed Feb 13, 2024
1 parent dedd758 commit 2124833
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/store-sync/src/postgres/columnTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ export const asHexArray = (name: string) =>
dataType() {
return "bytea[]";
},
toDriver(data: Hex[]): ByteArray[] {
return data.map((datum) => hexToBytes(datum));
},
fromDriver(driverData: ByteArray[]): Hex[] {
return driverData.map((datum) => bytesToHex(datum));
},
})(name);

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
Expand All @@ -113,4 +119,10 @@ export const asAddressArray = (name: string) =>
dataType() {
return "bytea[]";
},
toDriver(data: Address[]): ByteArray[] {
return data.map((datum) => hexToBytes(datum));
},
fromDriver(driverData: ByteArray[]): Address[] {
return driverData.map((datum) => getAddress(bytesToHex(datum)));
},
})(name);

0 comments on commit 2124833

Please sign in to comment.