Buckets:
| import { z } from "zod" | |
| import { eq } from "drizzle-orm" | |
| import { fn } from "./util/fn" | |
| import { Database } from "./drizzle" | |
| import { Identifier } from "./identifier" | |
| import { AccountTable } from "./schema/account.sql" | |
| export namespace Account { | |
| export const create = fn( | |
| z.object({ | |
| id: z.string().optional(), | |
| }), | |
| async (input) => | |
| Database.use(async (tx) => { | |
| const id = input.id ?? Identifier.create("account") | |
| await tx.insert(AccountTable).values({ | |
| id, | |
| }) | |
| return id | |
| }), | |
| ) | |
| export const fromID = fn(z.string(), async (id) => | |
| Database.use((tx) => | |
| tx | |
| .select() | |
| .from(AccountTable) | |
| .where(eq(AccountTable.id, id)) | |
| .then((rows) => rows[0]), | |
| ), | |
| ) | |
| } | |
Xet Storage Details
- Size:
- 772 Bytes
- Xet hash:
- 71ca610e6b26edcb0ce1491325734f253ceb4d62f13658f62212a9e2c41c3e3b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.