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/image-url.jpg%20%22Image%20title%22?q=database&page=341&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 4144 results for "database"(458ms)

reactHonoExamplequeries.ts2 matches

@shouser•Updated 1 month ago
3import { createTables, tableName } from "./migrations.ts";
4
5// This will create the database table if it doesn't exist.
6// This will run every time the app starts up. You can
7// comment out this line for a modest (30ms) perforamnce improvement
8// on cold starts. It's left in to ensure the database tables are
9// automatically set up correctly for users who fork this app.
10await createTables();

reactHonoExamplemigrations.ts1 match

@shouser•Updated 1 month ago
13
14 However, you should know that SQLite has much more limited
15 support for altering existing tables as compared to other databases.
16 Often it's easier to create new tables with the schema you want, and then
17 copy the data over. */

reactHonoExampleindex.ts1 match

@shouser•Updated 1 month ago
2import { readFile, servePublicFile } from "https://esm.town/v/stevekrouse/utils@187-main/serve-public/index.ts";
3import { Hono } from "npm:hono";
4import { getMessages, insertMessage } from "./database/queries.ts";
5
6const app = new Hono();

windsurf_projectContextmain.tsx1 match

@Emailscompelling•Updated 1 month ago
499 const KEY = "windsurf_projectContext";
500
501 // Initialize database
502 await sqlite.execute(`
503 CREATE TABLE IF NOT EXISTS ${KEY}_project_state_${SCHEMA_VERSION} (

cerebras_coderindex2 matches

@usuf•Updated 1 month ago
1import { generateCode } from "./backend/generate-code";
2import { createTables } from "./database/migrations";
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {

AlwaysHereBackendindex.ts1 match

@ninadxc•Updated 1 month ago
28 updateFriendRequestStatus,
29 updateUser,
30} from "./database/queries.ts";
31
32const app = new Hono();

EchoPromptermain.tsx8 matches

@Learn•Updated 1 month ago
940 const openai = new OpenAI();
941
942 // Use the val's URL as a unique key for database tables
943 const KEY = "EchoPrompter";
944
945 // Initialize database tables
946 await sqlite.execute(`
947 CREATE TABLE IF NOT EXISTS ${KEY}_agents (
976 });
977 } catch (error) {
978 console.error("Database error:", error);
979 return new Response(
980 JSON.stringify({ error: "Failed to fetch recent agents" }),
1172 }
1173
1174 // Insert into database with commands
1175 const result = await sqlite.execute(
1176 `INSERT INTO ${KEY}_agents (name, description, prompt, commands) VALUES (?, ?, ?, ?)`,
1212 const { agentId, message, history } = await request.json();
1213
1214 // Get agent from database
1215 const agentResult = await sqlite.execute(
1216 `SELECT * FROM ${KEY}_agents WHERE id = ?`,
1262 const response = completion.choices[0].message.content;
1263
1264 // Log conversation in database
1265 await sqlite.execute(
1266 `INSERT INTO ${KEY}_conversations (agent_id, user_message, assistant_response) VALUES (?, ?, ?)`,
1291 const { agentId, command, inputs, history } = await request.json();
1292
1293 // Get agent from database
1294 const agentResult = await sqlite.execute(
1295 `SELECT * FROM ${KEY}_agents WHERE id = ?`,
1475}
1476
1477async function initDatabase(db) {
1478 // Create agents table if not exists
1479 await db.execute(`

Brainblastmain.tsx1 match

@orjpap•Updated 1 month ago
38 `);
39
40 // Insert the game into the database
41 await sqlite.execute({
42 sql: `INSERT INTO games (gameId, player1) VALUES (:gameId, :player1)`,

cerebras_coderindex2 matches

@Learn•Updated 1 month ago
1import { generateCode } from "./backend/generate-code";
2import { createTables } from "./database/migrations";
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {

OpenTowniethink.ts1 match

@stevekrouse•Updated 1 month ago
7export const thinkTool = tool({
8 description:
9 "Use the tool to think about something. It will not obtain new information or change the database, but just append the thought to the log. Use it when complex reasoning or some cache memory is needed.",
10 parameters: z.object({
11 thought: z.string().describe("A thought to think about."),

bookmarksDatabase

@s3thi•Updated 2 months ago

sqLiteDatabase1 file match

@ideofunk•Updated 5 months ago