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=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 3891 results for "database"(1396ms)

sqlitemain.tsx2 matches

@nicosql•Updated 7 months ago
5/**
6 * Every Val Town account comes with its own private
7 * [SQLite database](https://www.sqlite.org/) that
8 * is accessible from any of your vals.
9 * ([Docs ↗](https://docs.val.town/std/sqlite))
115
116// adapted from
117// https://github.com/tursodatabase/libsql-client-ts/blob/17dd996b840c950dd22b871adfe4ba0eb4a5ead3/packages/libsql-client/src/sqlite3.ts#L314C1-L337C2
118function rowFromSql(
119 sqlRow: Array<unknown>,

sqliteExplorerAppREADME.md1 match

@florian42•Updated 7 months 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

iframeGridInfinitemain.tsx11 matches

@maxm•Updated 7 months ago
1/**
2 * This val creates an infinite grid of iframes with thick draggable borders.
3 * It includes a welcome modal, fixes the drag state issue, and stores iframe URLs in a database.
4 */
5
65 const [showModal, setShowModal] = useState(true);
66 const [iframes, setIframes] = useState([]);
67 const [urlDatabase, setUrlDatabase] = useState({});
68 const [isLoading, setIsLoading] = useState(false);
69 const gridRef = useRef(null);
86 useEffect(() => {
87 updateIframes();
88 }, [position, windowSize, urlDatabase]);
89
90 useEffect(() => {
91 loadUrlDatabase();
92 }, []);
93
131 left,
132 top,
133 url: urlDatabase[key] || '',
134 });
135 }
150 });
151 if (!response.ok) throw new Error('Failed to submit URL');
152 const updatedDatabase = await response.json();
153 setUrlDatabase(updatedDatabase);
154 } catch (error) {
155 console.error('Error submitting URL:', error);
160 };
161
162 const loadUrlDatabase = async () => {
163 try {
164 const response = await fetch('/api/load-urls');
165 if (!response.ok) throw new Error('Failed to load URLs');
166 const loadedUrls = await response.json();
167 setUrlDatabase(loadedUrls);
168 } catch (error) {
169 console.error('Error loading URLs:', error);
229
230 const result = await sqlite.execute(`SELECT * FROM ${KEY}_urls`);
231 const updatedDatabase = Object.fromEntries(result.rows.map(row => [row.key, row.url]));
232
233 return new Response(JSON.stringify(updatedDatabase), {
234 headers: { 'Content-Type': 'application/json' },
235 });

allmapsREADME.md1 match

@sammeltassen•Updated 7 months ago
1## Random Maps API
2
3This val returns one or more random rows from a [SQLite database](https://docs.val.town/std/sqlite/usage/) as a JSON array. Each item represents a digitised map from a collection and contains the following properties:
4
5```js

bikeInventorymain.tsx4 matches

@all•Updated 7 months ago
123 const initDb = async () => {
124 try {
125 const database = await init({ appId: APP_ID });
126 setDb(database);
127 console.log("InstantDB initialized successfully");
128 } catch (err) {
129 console.error("Error initializing InstantDB:", err);
130 setError(`Failed to initialize database: ${err.message}`);
131 }
132 };
166 }
167 } else {
168 setError("Database not initialized. Please refresh the page.");
169 }
170 };

sqliteExplorerAppREADME.md1 match

@flymaster•Updated 7 months 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

ghdbREADME.md1 match

@begoon•Updated 7 months ago
1This val implements a simple key/value database with GitHub, in a CRUD way.
2
3The key is a file path within a repository. The value is the file content.

add_to_notion_w_aiREADME.md4 matches

@eyeseethru•Updated 7 months ago
1Uses instructor and open ai (with gpt-4-turbo) to process any content into a notion database entry.
2
3Use `addToNotion` with any database id and content.
4
5```
10```
11
12Prompts are created based on your database name, database description, property name, property type, property description, and if applicable, property options (and their descriptions).
13
14Supports: checkbox, date, multi_select, number, rich_text, select, status, title, url, email
15
16- Uses `NOTION_API_KEY`, `OPENAI_API_KEY` stored in env variables and uses [Valtown blob storage](https://esm.town/v/std/blob) to store information about the database.
17- Use `get_notion_db_info` to use the stored blob if exists or create one, use `get_and_save_notion_db_info` to create a new blob (and replace an existing one if exists).

add_to_notion_w_aimain.tsx17 matches

@eyeseethru•Updated 7 months ago
37function createPrompt(title, description, properties) {
38 let prompt =
39 "You are processing content into a database. Based on the title of the database, its properties, their types and options, and any existing descriptions, infer appropriate values for the fields:\n";
40 prompt += `Database Title: ${title}\n`;
41
42 if (description) {
43 prompt += `Database Description: ${description}\n\n`;
44 } else {
45 prompt += "\n";
111}
112
113async function get_and_save_notion_db_processed_properties(databaseId)
114{
115 const response = await notion.databases.retrieve({ database_id: databaseId });
116 const db_id = response.id.replaceAll("-", "");
117 const processed_properties = processProperties(response);
122}
123
124async function get_notion_db_info(databaseId) {
125 databaseId = databaseId.replaceAll("-", "");
126 let db_info = null;
127 try {
128 db_info = await blob.getJSON(databaseId);
129 if (!db_info) {
130 throw new Error("db_info is null or undefined");
131 }
132 } catch (error) {
133 db_info = await get_and_save_notion_db_processed_properties(databaseId);
134 }
135 db_info["zod_schema"] = createZodSchema(db_info["filteredProps"]);
137}
138
139async function get_and_save_notion_db_info(databaseId) {
140 databaseId = databaseId.replaceAll("-", "");
141 let db_info = await get_and_save_notion_db_processed_properties(databaseId);
142 db_info["zod_schema"] = createZodSchema(db_info["filteredProps"]);
143 return db_info;
283}
284
285async function addToNotion(databaseId, text) {
286 databaseId = databaseId.replaceAll("-", "");
287 const properties = await process_text(databaseId, text);
288 console.log(properties);
289 const response = await notion.pages.create({
290 "parent": {
291 "type": "database_id",
292 "database_id": databaseId,
293 },
294 "properties": properties,

duckDBmain.tsx2 matches

@adjacent•Updated 7 months 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`);

bookmarksDatabase

@s3thi•Updated 2 months ago

sqLiteDatabase1 file match

@ideofunk•Updated 5 months ago