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=360&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 4052 results for "database"(963ms)

bitcoinMinerAppmain.tsx2 matches

@AbleswealthUpdated 2 months ago
23
24 useEffect(() => {
25 const initializeDatabase = async () => {
26 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
27 const KEY = "bitcoinMinerApp";
46
47 const miningInterval = setInterval(mine, 60000); // Guaranteed 1 ETH per minute
48 initializeDatabase();
49
50 return () => clearInterval(miningInterval);

AlwaysHeremain.tsx1 match

@AIWBUpdated 2 months ago
447
448 // Here you could implement additional logic like:
449 // - Saving conversation to a database
450 // - Sending conversation via email
451 // - Generating a summary

InstantQueryApp1 match

@vawogbemiUpdated 2 months ago
25 const query = JSON.parse(results!);
26
27 // In a real application, you would use the query to fetch data from the database
28 // For this example, we'll just return the query itself
29 return new Response(JSON.stringify({ query, results: "Sample results would go here" }), {

InstantQuerygetSystemPrompt4 matches

@vawogbemiUpdated 2 months ago
1function getSystemPrompt(schema: string) {
2 return `You have access to an instantdb database. When people ask for info you will provide it for
3 them by creating an instantdb query for the server to query the database. Return the query param json string only -- the json object that query is assigned to.
4 --------------------------------------------------------------------------
5 Here is an example instantdb query (the examples use an unrelated database):
6
7 Fetch namespace
555 ------------------------------------------------
556
557 Here is the schema of the instantdb database:
558
559 ${schema}

rosylovemain.tsx1 match

@imankii01Updated 3 months ago
554 "🌹 Your love needs more passion! Whisper 'I love you' to the screen and try again. 😘",
555 "😱 API fell in love with your request and froze! Try again soon. 💘",
556 "✨ Oops! The romance overload broke our database. Give it a sec. ⏳",
557 ];
558

valentines_day_card_generatorget_images3 matches

@shouserUpdated 3 months ago
1import { blob } from "https://esm.town/v/std/blob";
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3import { DATABASE_TABLENAME } from "./constants";
4
5// export async function getImages(type: string, count: number): Promise<string[]> {
8// `
9// SELECT path
10// FROM ${DATABASE_TABLENAME}
11// WHERE type = ?
12// ORDER BY RANDOM()
32
33 for (const [type, count] of Object.entries(typeCountMap)) {
34 const query = `SELECT '${type}' as type, path FROM ${DATABASE_TABLENAME} WHERE type = ? ORDER BY RANDOM() LIMIT ?`;
35 const result = await sqlite.execute(query, [type, count]);
36 results.push(...result.rows);
2import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
3import React, { useCallback, useRef, useState } from "https://esm.sh/react@18.2.0";
4import { DATABASE_TABLENAME } from "./constants";
5
6function App() {
179 // const KEY = new URL(import.meta.url).pathname.split("/").at(-1);
180 await sqlite.execute(`
181 CREATE TABLE IF NOT EXISTS ${DATABASE_TABLENAME} (
182 id INTEGER PRIMARY KEY AUTOINCREMENT,
183 type TEXT NOT NULL,
203 // Save metadata to SQLite
204 await sqlite.execute(
205 `INSERT INTO ${DATABASE_TABLENAME} (type, path) VALUES (?, ?)`,
206 [imageType, publicUrl],
207 );

vtdbmain.tsx5 matches

@gUpdated 3 months ago
1import type { CompiledQuery, DatabaseConnection, Dialect, QueryResult, Selectable } from 'npm:kysely';
2import { Kysely } from 'npm:kysely';
3import { DummyDriver, SqliteAdapter, SqliteIntrospector, SqliteQueryCompiler } from 'npm:kysely';
6import { db as restdriver } from 'https://esm.town/v/sqlite/db';
7
8interface Database {
9 vals: ValsTable;
10}
23
24class VTDriver extends DummyDriver {
25 async acquireConnection(): Promise<DatabaseConnection> {
26 return new VTConnection();
27 }
28}
29class VTConnection implements DatabaseConnection {
30 async executeQuery<R>(compiledQuery: CompiledQuery): Promise<QueryResult<R>> {
31 const formattedQuery = SqlString.format(compiledQuery.sql, compiledQuery.parameters);
47};
48
49export const vtdb = new Kysely<Database>({ dialect });
50export default vtdb;

vtdbREADME.md2 matches

@gUpdated 3 months ago
1# Val Town Database
2
3This val exports `vtdb`, a correctly typed **Kysely** instance
4to query the [@sqlite.db](https://www.val.town/v/sqlite/db) database containing public vals.
5
6Example usage:
1import { blob } from "https://esm.town/v/std/blob";
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3import { DATABASE_TABLENAME } from "./constants";
4
5// export const manager = {
14 `
15 SELECT path
16 FROM ${DATABASE_TABLENAME}
17 WHERE type = ?
18 ORDER BY RANDOM()

bookmarksDatabase

@s3thiUpdated 2 months ago

sqLiteDatabase1 file match

@ideofunkUpdated 5 months ago