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/?q=database&page=270&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 2775 results for "database"(423ms)

HONCtypes.ts2 matches

@fiberplane•Updated 1 month ago
1import type { LibSQLDatabase } from "../deps/drizzle.ts";
2import type * as schema from "./schema";
3
4export type DBType = LibSQLDatabase<typeof schema>;

HONCmigrate.ts1 match

@fiberplane•Updated 1 month ago
5 * For this reason, we need to manually create the users table.
6 */
7export const migrateDatabase = async () => {
8 await sqlite.execute(`
9CREATE TABLE IF NOT EXISTS \`users\` (

cerebras_coderindex2 matches

@Rai•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> {

cerebras_coderindex2 matches

@Time•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> {

OpenTelemetryCollectorindex.ts4 matches

@fiberplane•Updated 1 month ago
3import type { AppType } from "./app/types.ts";
4import { db } from "./db/client.ts";
5import { migrateDatabase } from "./db/migrate.ts";
6import { createFiberplane } from "./deps/fiberplane.ts";
7import { Hono, HTTPException } from "./deps/hono.ts";
8import { getOpenAPISpec } from "./openapi.ts";
9
10// Migrate database on startup to make sure the proper table exists to store spans
11await migrateDatabase();
12
13const app = new Hono<AppType>();
14
15/**
16 * Middleware for setting up the database and storing it on the Hono app's context
17 */
18app.use(async (ctx, next) => {

OpenTelemetryCollectorclient.ts2 matches

@fiberplane•Updated 1 month ago
5
6/**
7 * The typed database client, allowing us to construct sql queries and
8 * use Drizzle's ORM features against the ValTown sqlite database
9 */
10export const db: DBType = drizzle(sqlite as any, {

OpenTelemetryCollectortypes.ts2 matches

@fiberplane•Updated 1 month ago
1import type { LibSQLDatabase } from "../deps/drizzle.ts";
2import type * as schema from "./schema";
3
4export type DBType = LibSQLDatabase<typeof schema>;

OpenTelemetryCollectordrizzle.ts2 matches

@fiberplane•Updated 1 month ago
1// Import drizzle deps with npm: specifier because exports don't get picked up properly by typescript when using esm.sh
2import { drizzle, type LibSQLDatabase } from "npm:drizzle-orm@0.39.3/libsql";
3import { and, desc, relations, sql } from "npm:drizzle-orm@0.39.3";
4import { integer, sqliteTable, text } from "npm:drizzle-orm@0.39.3/sqlite-core";
5
6export { drizzle };
7export type { LibSQLDatabase };
8export { and, desc, relations, sql };
9export { integer, sqliteTable, text };

OpenTelemetryCollectormigrate.ts1 match

@fiberplane•Updated 1 month ago
8 * @TODO - Add `start_time` and `end_time` columns
9 */
10export const migrateDatabase = async () => {
11 await sqlite.execute(`
12CREATE TABLE IF NOT EXISTS \`${SPAN_TABLE_NAME}\` (

reactHonoExampleREADME.md2 matches

@varun1352•Updated 1 month ago
4
5* `index.ts` - this is the **entrypoint** for this whole project
6* `database/` - this contains the code for interfacing with the app's SQLite database table
7
8## Hono
26## CRUD API Routes
27
28This app has two CRUD API routes: for reading and inserting into the messages table. They both speak JSON, which is standard. They import their functions from `/backend/database/queries.ts`. These routes are called from the React app to refresh and update data.
29
30## Errors