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=365&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 3920 results for "database"(2012ms)

sqliteExplorerAppREADME.md1 match

@teamgroove•Updated 8 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

sqliteExplorerAppREADME.md1 match

@peterhartree•Updated 8 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

checkHackerNewsForPatreonmain.tsx3 matches

@mikker•Updated 8 months ago
1// This val checks Hacker News for news about Patreon, Buy Me A Coffee, and Ko-fi,
2// sends an email alert if any are found, and keeps track of notified stories in a database.
3// It runs automatically every hour.
4
9const TABLE_NAME = `${KEY}_notified_stories`;
10
11async function initializeDatabase() {
12 await sqlite.execute(`
13 CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
20
21async function checkHackerNewsForPatreon() {
22 await initializeDatabase();
23
24 const response = await fetch("https://hacker-news.firebaseio.com/v0/newstories.json");

notionGetDatabaseREADME.md3 matches

@junhoca•Updated 8 months ago
1# Get all the pages in a notion database
2
3## Usage
4
51. Find your `databaseId`: https://developers.notion.com/reference/retrieve-a-database
62. Get `auth` by setting up an internal integration: https://developers.notion.com/docs/authorization#internal-integration-auth-flow-set-up
7
8Example usage: @stevekrouse.dateMeNotionDatabase
9
10deno-notion-sdk docs: https://github.com/cloudydeno/deno-notion_sdk

notionGetDatabasemain.tsx4 matches

@junhoca•Updated 8 months ago
1export const notionGetDatabase = async ({ databaseId, auth, filter }: {
2 databaseId: string;
3 auth: string;
4 filter?: any;
8 );
9 const notion = new Client({ auth });
10 return collectPaginatedAPI(notion.databases.query, {
11 database_id: databaseId,
12 filter,
13 });

add_to_notion_w_aiREADME.md4 matches

@junhoca•Updated 8 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

@junhoca•Updated 8 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,

luciaValtownSqlitemain.tsx22 matches

@yawnxyz•Updated 8 months ago
6import type {
7 Adapter,
8 DatabaseSession,
9 DatabaseUser,
10 RegisteredDatabaseSessionAttributes,
11 RegisteredDatabaseUserAttributes,
12} from "npm:lucia";
13
23}
24
25interface SessionSchema extends RegisteredDatabaseSessionAttributes {
26 id: string;
27 user_id: string;
29}
30
31interface UserSchema extends RegisteredDatabaseUserAttributes {
32 id: string;
33}
59 public async getSessionAndUser(
60 sessionId: string,
61 ): Promise<[session: DatabaseSession | null, user: DatabaseUser | null]> {
62 const [databaseSession, databaseUser] = await Promise.all([
63 this.getSession(sessionId),
64 this.getUserFromSessionId(sessionId),
65 ]);
66 return [databaseSession, databaseUser];
67 }
68
69 public async getUserSessions(userId: string): Promise<DatabaseSession[]> {
70 const result = await this.controller.getAll<SessionSchema>(
71 `SELECT * FROM ${this.escapedSessionTableName} WHERE user_id = ?`,
72 [userId],
73 );
74 return result.map((val) => transformIntoDatabaseSession(val));
75 }
76
77 public async setSession(databaseSession: DatabaseSession): Promise<void> {
78 const value: SessionSchema = {
79 id: databaseSession.id,
80 user_id: databaseSession.userId,
81 expires_at: Math.floor(databaseSession.expiresAt.getTime() / 1000),
82 ...databaseSession.attributes,
83 };
84 const entries = Object.entries(value).filter(([_, v]) => v !== undefined);
108 }
109
110 private async getSession(sessionId: string): Promise<DatabaseSession | null> {
111 const result = await this.controller.get<SessionSchema>(
112 `SELECT * FROM ${this.escapedSessionTableName} WHERE id = ?`,
114 );
115 if (!result) return null;
116 return transformIntoDatabaseSession(result);
117 }
118
119 private async getUserFromSessionId(sessionId: string): Promise<DatabaseUser | null> {
120 const result = await this.controller.get<UserSchema>(
121 `SELECT ${this.escapedUserTableName}.* FROM ${this.escapedSessionTableName} INNER JOIN ${this.escapedUserTableName} ON ${this.escapedUserTableName}.id = ${this.escapedSessionTableName}.user_id WHERE ${this.escapedSessionTableName}.id = ?`,
123 );
124 if (!result) return null;
125 return transformIntoDatabaseUser(result);
126 }
127}
236}
237
238function transformIntoDatabaseSession(raw: SessionSchema): DatabaseSession {
239 const { id, user_id: userId, expires_at: expiresAtUnix, ...attributes } = raw;
240 return {
246}
247
248function transformIntoDatabaseUser(raw: UserSchema): DatabaseUser {
249 const { id, ...attributes } = raw;
250 return {

lucia_middlewaremain.tsx2 matches

@yawnxyz•Updated 8 months ago
49 interface Register {
50 Lucia: typeof lucia;
51 DatabaseUserAttributes: DatabaseUserAttributes;
52 }
53}
54
55interface DatabaseUserAttributes {
56 github_id: number;
57 username: string;

sqliteExplorerAppREADME.md1 match

@wxw•Updated 8 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

bookmarksDatabase

@s3thi•Updated 2 months ago

sqLiteDatabase1 file match

@ideofunk•Updated 5 months ago