diff options
| author | akiyamn | 2023-10-04 23:29:19 +1100 |
|---|---|---|
| committer | akiyamn | 2023-10-04 23:29:19 +1100 |
| commit | a2d1c179f88e056265321b426a51907a3941044a (patch) | |
| tree | 3804227ee072265a1cf1121cc59eb1fbdc74a3e2 /src/store.ts | |
| parent | 4e87195739f2a5d9a05451b48773c8afdc680765 (diff) | |
| download | price-tracker-worker-a2d1c179f88e056265321b426a51907a3941044a.tar.gz price-tracker-worker-a2d1c179f88e056265321b426a51907a3941044a.zip | |
Kind of worksmaster
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 |
