diff options
Diffstat (limited to 'src/store.ts')
| -rw-r--r-- | src/store.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/store.ts b/src/store.ts new file mode 100644 index 0000000..9e98254 --- /dev/null +++ b/src/store.ts @@ -0,0 +1,10 @@ +import { ProductInfo } from "./gather"; + +export async function storePriceRecord(db: D1Database, product: ProductInfo): Promise<boolean> { + const query = 'INSERT INTO Prices (CompanyName, ProductName, Price, AccessDate, Picture) VALUES (?1, ?2, ?3, ?4, ?5)' + const { results, success } = await db.prepare(query) + .bind(product.companyName, product.productName, product.price, product.accessDate, product.picture) + .run(); + console.log(results, success) + return success +}
\ No newline at end of file |
