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=162&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 5046 results for "database"(1486ms)

vtProjectSearch

vtProjectSearchdb.ts3 matches

@maxmโ€ขUpdated 2 weeks ago
190
191/**
192 * Get database statistics for the homepage
193 */
194export async function getSearchStats(): Promise<{
873 const offset = (page - 1) * pageSize;
874
875 // Start all database queries in parallel
876 // 1. Launch count queries
877 const countsPromise = withTiming(() => Promise.all([
960 ));
961
962 // Wait for all database operations to complete in parallel
963 const [
964 [countsResult, countsTime],
vtProjectSearch

vtProjectSearch.cursorrules2 matches

@maxmโ€ขUpdated 2 weeks ago
198```
199โ”œโ”€โ”€ backend/
200โ”‚ โ”œโ”€โ”€ database/
201โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Schema definitions
202โ”‚ โ”‚ โ”œโ”€โ”€ queries.ts # DB query functions
257 ```
258
259### Database Patterns
260- Run migrations on startup or comment out for performance
261- Change table names when modifying schemas rather than altering

pondiverseaddCreation2 matches

@iliazeusโ€ขUpdated 2 weeks ago
46 }
47
48 // Now it's time to upload things to database and blob storage
49 // First, add to database, and get the ID
50 const id = await sqlite.execute(
51 `INSERT INTO ${TABLE_NAME} (title, data, type, time) VALUES ($title, $data, $type, CURRENT_TIMESTAMP)`,

OpenTownie_jacksonthreads.ts1 match

@stevekrouseโ€ขUpdated 2 weeks ago
1import { Hono } from "npm:hono";
2import { createThread, getThreadMessages, getUserThreads } from "../database/queries.ts";
3
4const app = new Hono();

OpenTownie_jacksonqueries.ts13 matches

@stevekrouseโ€ขUpdated 2 weeks ago
3import { type Message, type Thread, type User } from "../../shared/types.ts";
4import {
5 type DatabaseMessage,
6 type DatabaseThread,
7 type DatabaseUser,
8 MESSAGES_TABLE,
9 THREADS_TABLE,
11} from "./schema.ts";
12
13function parseDatabaseUser(user: DatabaseUser): User {
14 return {
15 id: user.id,
21}
22
23function parseDatabaseThread(thread: DatabaseThread): Thread {
24 return {
25 id: thread.id,
32}
33
34function parseDatabaseMessage(message: DatabaseMessage): Message {
35 return {
36 id: message.id,
60 );
61 if (result.rows && result.rows.length > 0) {
62 return parseDatabaseUser(result.rows[0]);
63 }
64
78 );
79 if (result2.rows && result2.rows.length > 0) {
80 return parseDatabaseUser(result2.rows[0]);
81 }
82
90 );
91 if (result3.rows && result3.rows.length > 0) {
92 return parseDatabaseUser(result3.rows[0]);
93 }
94 throw new Error("Failed to create user");
126
127 if (result.rows && result.rows.length > 0) {
128 return parseDatabaseThread(result.rows[0]);
129 }
130 return null;
136 [userId],
137 );
138 return (result.rows || []).map(parseDatabaseThread);
139}
140
144 [valId],
145 );
146 return (result.rows || []).map(parseDatabaseThread);
147}
148
155 );
156
157 return (result.rows || []).map(parseDatabaseMessage);
158}
159

OpenTownie_jacksonschema.ts3 matches

@stevekrouseโ€ขUpdated 2 weeks ago
5export const MESSAGES_TABLE = "opentownie_messages";
6
7export interface DatabaseUser {
8 id: string;
9 username: string;
13}
14
15export interface DatabaseThread {
16 id: string;
17 user_id: string;
22}
23
24export interface DatabaseMessage {
25 id: number;
26 thread_id: string;
2import { createMiddleware } from "npm:hono/factory";
3import { type User } from "../../shared/types.ts";
4import { getOrCreateUser } from "../database/queries.ts";
5
6export const auth = createMiddleware<{

OpenTownie_jacksonsend-message.ts1 match

@stevekrouseโ€ขUpdated 2 weeks ago
3import { convertToCoreMessages, type CoreUserMessage, streamText } from "npm:ai";
4import { Hono } from "npm:hono";
5import { createThread, saveMessage } from "../database/queries.ts";
6import { getTextEditorTool, makeChangeValTypeTool, makeDeleteTool, thinkTool } from "../tools/index.ts";
7import fileWithLinesNumbers from "../utils/fileWithLinesNumbers.ts";
1import { Hono } from "npm:hono";
2import { createAnthropic } from "npm:@ai-sdk/anthropic";
3import { updateThreadName } from "../database/queries.ts";
4
5export async function generateThreadName(apiKey, firstMessage, anthropicApiKey) {

sqliteExplorerAppREADME.md1 match

@skynocoverโ€ขUpdated 2 weeks ago
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable

bookmarksDatabase

@s3thiโ€ขUpdated 3 months ago

sqLiteDatabase1 file match

@ideofunkโ€ขUpdated 6 months ago