Slide 17
Slide 17 text
Copyright (C) 2021 Toranoana Inc. All Rights Reserved.
利用技術/モジュール - SQLite
import { DB } from "https://deno.land/x/sqlite/mod.ts";
const db = new DB("scraping.db");
db.execute(`
CREATE TABLE IF NOT EXISTS download_logs (
url TEXT,
path TEXT,
created_at INTEGER
)
`);
db.execute(`
CREATE TABLE IF NOT EXISTS inspection_logs (
targetUrlPathName TEXT primary key,
isExist INTEGER,
created_at INTEGER
)
`);
export function insertDownloadLog(url: string, path: string) {
const timestamp = new Date().getTime();
db.query("INSERT INTO download_logs (url, path, created_at) VALUES (?, ?, ?)",
[url, path, timestamp],
);
}