Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7Bsuccess?q=database&page=265&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=database

Returns an array of strings in format "username" or "username/projectName"

Found 4634 results for "database"(1019ms)

stevensDemopopulateDemo.ts4 matches

@gburtโ€ขUpdated 1 month ago
374];
375
376// Insert memories into the database
377async function insertDemoMemories() {
378 try {
415 await insertDemoMemories();
416
417 console.log("Demo database successfully populated!");
418 return "Demo database successfully populated!";
419 } catch (error) {
420 console.error("Error populating demo database:", error);
421 throw error;
422 }

stevensDemomemoryUtils.ts1 match

@gburtโ€ขUpdated 1 month ago
2
3/**
4 * Retrieves all memories from the database
5 * @param includeDate Whether to include date-specific memories or not
6 * @param startDate Optional start date to filter memories from (ISO format)

stevensDemoindex.ts1 match

@gburtโ€ขUpdated 1 month ago
12 getAllMemories,
13 updateMemory,
14} from "./database/queries.ts";
15import { type Memory } from "../shared/types.ts";
16import { blob } from "https://esm.town/v/std/blob";

stevensDemohandleTelegramMessage.ts1 match

@gburtโ€ขUpdated 1 month ago
34
35/**
36 * Store a chat message in the database
37 */
38export async function storeChatMessage(

stevensDemogetWeather.ts1 match

@gburtโ€ขUpdated 1 month ago
130 }
131
132 console.log(`Weather forecast updated in the database.`);
133 return summary;
134}

stevensDemogetCalendarEvents.ts1 match

@gburtโ€ขUpdated 1 month ago
125 }
126
127 console.log(`Calendar events imported into the database.`);
128 return events;
129 } catch (error) {

stevensDemogenerateFunFacts.ts2 matches

@gburtโ€ขUpdated 1 month ago
8
9/**
10 * Retrieves previously generated fun facts from the memories database
11 * @returns Array of previous fun facts
12 */
47
48/**
49 * Inserts a fun fact into the memories database
50 * @param date Date for the fun fact in ISO format
51 * @param factText The fun fact text

stevensDemo.cursorrules2 matches

@gburtโ€ขUpdated 1 month ago
208```
209โ”œโ”€โ”€ backend/
210โ”‚ โ”œโ”€โ”€ database/
211โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Schema definitions
212โ”‚ โ”‚ โ”œโ”€โ”€ queries.ts # DB query functions
270- Handle API calls properly with proper error catching
271
272### Database Patterns
273- Run migrations on startup or comment out for performance
274- Change table names when modifying schemas rather than altering

stevensDemosetupTelegramChatDb.ts1 match

@yumyabโ€ขUpdated 1 month ago
39 return {
40 success: true,
41 message: "Telegram chat database table created successfully.",
42 verification: tableCheck.rows,
43 };

ValTownForNotionwebhookAPI15 matches

@stevekrouseโ€ขUpdated 1 month ago
24});
25
26app.post("/example/database/pages", async (c) => {
27 // blob keys map to endpoints for the cron resets
28 const blobKey = await c.req.url.replace("https://", "");
29 const askingFor = c.req.headers.get("asking_for") || "default"; // val.town or default
30
31 // capture the database id to store in the blob
32 const targetId = c.req.headers.get("target_id");
33
34 // get the pages in this database
35 const databaseChildren = await notion.databases.query({ database_id: targetId });
36 // delete all pages to prevent bad actors from leaving naughty rows behi
37 for (const [key, child] of databaseChildren.results.entries()) {
38 const page = await notion.pages.update({
39 page_id: child.id,
42 }
43
44 // get the database
45 const database = await notion.databases.retrieve({ database_id: targetId });
46 // convert the statuses string in the status property into JSON
47 const statuses = JSON.parse(database?.properties?.Statuses?.formula?.expression);
48 // get the first item on the list of statuses, to set the status for new pages
49 const status = statuses[0];
50 // add back pages; fresh start for the next person to add favicons
51 const defaults = ["val.town", "notion.com", "hono.dev"].reverse();
52 // create new database pages from default object
53 for (const item of defaults) {
54 const page = await notion.pages.create({
55 parent: {
56 type: "database_id",
57 database_id: targetId,
58 },
59 properties: {
88});
89
90app.post("/example/database/page", async (c) => {
91 const payload = await c.req.json();
92 const data = await payload?.data;
100
101 // store webhook data in blob storage for resets
102 // capture the database id to store in the blob
103 const databaseId = data?.parent?.database_id;
104 const blobObject = {
105 id: databaseId,
106 date: new Date(),
107 content: askingFor,

bookmarksDatabase

@s3thiโ€ขUpdated 3 months ago

sqLiteDatabase1 file match

@ideofunkโ€ขUpdated 5 months ago