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=254&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 10131 results for "database"(5295ms)

Glancer_TestgetRelatedPagesFromDatabase.ts4 matches

@charmaineโ€ขUpdated 3 months ago
6});
7
8export async function getRelatedPagesFromDatabase(pageId: string) {
9 try {
10 const response = await notion.databases.query({
11 database_id: Deno.env.get("GLANCE_CONTENT_DB_ID"),
12 filter: {
13 property: "Glancer demos", // the property in the Glancer content database that connects to the /demo
14 relation: {
15 contains: pageId, // the Glancer demos property holds the /demo page id to which it is related

Glancer_TestgetDatabase.ts5 matches

@charmaineโ€ขUpdated 3 months ago
6});
7
8export async function getDatabase(id: string) {
9 // get database
10 try {
11 const database = await notion.databases.retrieve({
12 database_id: id,
13 });
14 return database;
15 } catch (error: any) {
16 return {

Glancer_TestgetActions.ts8 matches

@charmaineโ€ขUpdated 3 months ago
7
8export async function getAllInteractionsPages() {
9 const databaseId = Deno.env.get("GLANCE_INTERACTIONS_DB_ID");
10
11 if (!databaseId) {
12 throw new Error(
13 "GLANCE_INTERACTIONS_DB_ID environment variable is not set"
16
17 try {
18 const response = await notion.databases.query({
19 database_id: databaseId,
20 });
21
37
38export async function getAllInteractionsPagesWithPagination() {
39 const databaseId = Deno.env.get("GLANCE_INTERACTIONS_DB_ID");
40
41 if (!databaseId) {
42 throw new Error(
43 "GLANCE_INTERACTIONS_DB_ID environment variable is not set"
51
52 while (hasMore) {
53 const response = await notion.databases.query({
54 database_id: databaseId,
55 start_cursor: startCursor,
56 });

Glancer_Testdemo.ts2 matches

@charmaineโ€ขUpdated 3 months ago
7import { examplePDF } from "../../api/servePDF.ts";
8import { getPage } from "../../../controllers/getPage.ts";
9import { getRelatedPagesFromDatabase } from "../../../controllers/getRelatedPagesFromDatabase.ts";
10
11const app = new Hono();
34
35 // get related Glancer content
36 const relatedPages = await getRelatedPagesFromDatabase(id);
37 // console.log("relatedPages: ", relatedPages);
38

Glancer_Testdemo.ts1 match

@charmaineโ€ขUpdated 3 months ago
1import { Hono } from "npm:hono";
2import { getPage } from "../../controllers/getPage.ts";
3import { getDatabase } from "../../controllers/getDatabase.ts";
4
5const app = new Hono();

Glancer_TestdemoCache.ts5 matches

@charmaineโ€ขUpdated 3 months ago
12// that blob determines whether or not the cobrowsing button is ON or OFF
13export default async function (interval: Interval) {
14 // every page in the "Glancer demo" database should have it's own blob, so we have a cache for each demo
15 // this cron saves a blob for every page in the Demos DB
16 try {
17 // get notion pages with the databaseId
18 const pages = await notion.databases.query({
19 database_id: Deno.env.get("GLANCE_DEMOS_DB_ID"),
20 });
21 // for each page in the demo database, save a blob
22 for (const page of pages.results) {
23 const blobKey = await blobKeyForDemoCache(import.meta.url, page.id);

Glancer_Testdatabase.ts2 matches

@charmaineโ€ขUpdated 3 months ago
1import { Hono } from "npm:hono";
2import { getDatabase } from "../../controllers/getDatabase.ts";
3
4const app = new Hono();
9 // hit the controller to return data
10 try {
11 const data = await getDatabase(id);
12 //
13 console.log(data);

Glancer_Test.cursorrules2 matches

@charmaineโ€ขUpdated 3 months 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

Glancer_Testapi.ts2 matches

@charmaineโ€ขUpdated 3 months ago
3// Import route modules
4import cobrowse from "./cobrowse.ts";
5import database from "./database.ts";
6import demo from "./demo.ts";
7import page from "./page.ts";
12
13// mount routes
14app.route("/db", database);
15app.route("/page", page);
16app.route("/cobrowse", cobrowse);

GlancerrelatedPages.controller.ts5 matches

@charmaineโ€ขUpdated 3 months ago
7});
8
9export async function getRelatedPagesFromDatabase(pageId: string) {
10 try {
11 const response = await notion.databases.query({
12 database_id: Deno.env.get("GLANCE_CONTENT_DB_ID"),
13 filter: {
14 property: "Glancer demos", // the property in the Glancer content database that connects to the /demo
15 relation: {
16 contains: pageId, // the Glancer demos property holds the /demo page id to which it is related
25 });
26 // loop through the response and attach a "page_contents" object to each page
27 // page_content is the markdown in Notion in each "Glancer content" database page
28 for (const page of response.results) {
29 page.page_content = await getPageContents(page.id);

customer-database-setup2 file matches

@stevenvapiโ€ขUpdated 2 months ago

prDatabase

@pdwโ€ขUpdated 2 months ago