8 args?: any[],
9) => {
10 const { connect } = await import("npm:@planetscale/database");
11 const { host, username, password } = config;
12 const conn = connect({
1export async function duckDB(url) {
2 const { Database } = await import("npm:duckdb-async");
3 const db = await Database.create(":memory:");
4 await db.all("load httpfs");
5 return await db.all(`select * from "${url}" LIMIT 5`);
1// Outputs, e.g., "It is currently Sunday, May 21, 2023 at 12:11:04 PM Pacific Daylight Time."
2// timeZone should be a tz identifier as listed at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
3export function formatCurrentDatetimeSentence(timeZone: string): string {
4 const dateFormatter = new Intl.DateTimeFormat([], {
1import { databaseVal } from "https://esm.town/v/stevekrouse/databaseVal";
2
3export const untitled_NwQdD9zC = databaseVal.push({ hello: "world" });
22 process.env.supabaseKey,
23 );
24 // Query from the database to see if this link already exists
25 const { data, error } = await supabase
26 .from("linkedin_seedings")
34 if (data.length > 0) {
35 res.status(200).json({
36 message: "This link already exists in the database",
37 });
38 }
39 // Otherwise, start processing this new link
40 // First, retrieve documents in the database relevant to the post content
41 let relevantContent = await getRelevantContent(content);
42 let context = "";
1export const notionGetDatabase = async ({ databaseId, auth, filter }: {
2 databaseId: string;
3 auth: string;
4 filter?: any;
8 );
9 const notion = new Client({ auth });
10 return collectPaginatedAPI(notion.databases.query, {
11 database_id: databaseId,
12 filter,
13 });
1## Get All Rows of a Database in Notion
2
3Reference: [Query a Database](https://developers.notion.com/reference/post-database-query)
4
5How to get an access token: https://developers.notion.com/reference/create-a-token
1Migrated from folder: Archive/dateMeNotionDatabase
1# Val Town Migrations
2
3By calling this val, you can easily handle migrations in your Val Town Turso Database.
4
5## Getting started
7
81. Make sure you have your Val Town API Token saved in your secrets. See more about [authentication](https://docs.val.town/api/authentication) to understand how to generate a token.
91. Make sure you've [set up your turso database](https://www.val.town/v/std.turso)
101. **[👆Fork this val](https://www.val.town/v/neverstew.migration)**
11
12## How it works
13Each time the val is run, a new migration will be created and tracked in your database in the `migrations` table.
14
15There will be one migration per val, per version.
1### Demo of `mongo-http` NPM package
2
3- Great for **serverless** apps that can **only use HTTP** or **have a hard time persisting database connection**
4- See more at [the Git Repo](https://github.com/patrick-kw-chiu/mongo-http.js) and the [Medium tutorial](https://betterprogramming.pub/introducing-mongo-http-js-5ae2d74f2155)!
5- What this demo does: *Read the latest Chinese Medium posts with categories "javascript" or "typescript"*