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/$%7Bart_info.art.src%7D?q=database&page=164&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 7182 results for "database"(3523ms)

NanoCogmemory.ts1 match

@zoneโ€ขUpdated 1 week ago
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2import { tables } from "../database/schema.ts";
3import type { Memory, UserProfile, Atom } from "../../shared/types.ts";
4import { MiniAtomSpace } from "./atomspace.ts";

NanoCogatomspace.ts1 match

@zoneโ€ขUpdated 1 week ago
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
2import { tables } from "../database/schema.ts";
3import type { Atom, Link, AtomSpaceQuery } from "../../shared/types.ts";
4

NanoCogschema.ts1 match

@zoneโ€ขUpdated 1 week ago
6const USERS_TABLE = 'nanocog_users_v1';
7
8export async function initializeDatabase() {
9 // Atoms table - core knowledge representation
10 await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${ATOMS_TABLE} (

NanoCogREADME.md1 match

@zoneโ€ขUpdated 1 week ago
43โ”‚ โ”‚ โ”œโ”€โ”€ memory.ts # Memory formation and retrieval
44โ”‚ โ”‚ โ””โ”€โ”€ reasoning.ts # Pattern recognition and reasoning
45โ”‚ โ””โ”€โ”€ database/
46โ”‚ โ””โ”€โ”€ schema.ts # SQLite schema for persistence
47โ””โ”€โ”€ shared/

duckDBmain.tsx2 matches

@mr4kโ€ขUpdated 1 week ago
1import { Database } from "https://esm.sh/duckdb-async";
2
3export default async function server(request: Request): Promise<Response> {
10
11 try {
12 const db = await Database.create(':memory:');
13 await db.all('LOAD httpfs');
14 const result = await db.all(`SELECT * FROM '${dataUrl}' LIMIT 5`);

cerebras_codermain.tsx2 matches

@zoneโ€ขUpdated 1 week ago
1import { serveFile } from "https://esm.town/v/std/utils/index.ts";
2import { generateCode } from "./backend/generate-code.ts";
3import { createTables } from "./database/migrations.ts";
4import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries.ts";
5
6await createTables();

reactHonoStarterREADME.md1 match

@martindstoneโ€ขUpdated 1 week ago
21## Further resources
22
23- [React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a bigger example project, with a SQLite database table, queries, client-side CSS, a favicon, and shared code that runs on both client and server.

reactHonoExampleREADME.md2 matches

@notmartโ€ขUpdated 1 week 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

reactHonoExampleREADME.md6 matches

@notmartโ€ขUpdated 1 week ago
1# Database
2
3This app uses [Val Town SQLite](https://docs.val.town/std/sqlite/) to manage data. Every Val Town account comes with a free SQLite database, hosted on [Turso](https://turso.tech/). This folder is broken up into two files:
4
5* `migrations.ts` - code to set up the database tables the app needs
6* `queries.ts` - functions to run queries against those tables, which are imported and used in the main Hono server in `/backend/index.ts`
7
8## Migrations
9
10In `backend/database/migrations.ts`, this app creates a new SQLite table `reactHonoStarter_messages` to store messages.
11
12This "migration" runs once on every app startup because it's imported in `index.ts`. You can comment this line out for a slight (30ms) performance improvement on cold starts. It's left in so that users who fork this project will have the migration run correctly.
13
14SQLite has much more limited support for altering existing tables as compared to other databases. Often it's easier to create new tables with the schema you want, and then copy the data over. Happily LLMs are quite good at those sort of database operations, but please reach out in the [Val Town Discord](https://discord.com/invite/dHv45uN5RY) if you need help.
15
16## Queries
17
18The queries file is where running the migrations happen in this app. It'd also be reasonable for that to happen in index.ts, or as is said above, for that line to be commented out, and only run when actual changes are made to your database schema.
19
20The queries file exports functions to get and write data. It relies on shared types and data imported from the `/shared` directory.

reactHonoExamplequeries.ts2 matches

@notmartโ€ขUpdated 1 week 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();

bookmarksDatabase

@s3thiโ€ขUpdated 3 months ago

sqLiteDatabase1 file match

@ideofunkโ€ขUpdated 6 months ago