chore(example): regenerate basic-app queries
Regenerated output for the committed query generator: positional placeholders now render as $1 rather than ?. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import type { Db, ExecResult } from "@wrnexus/db";
|
|||||||
import { users } from "./schema.ts";
|
import { users } from "./schema.ts";
|
||||||
|
|
||||||
export async function GetUserByEmail(db: Db, args: { email: string }): Promise<{ id: number; email: string; name: string; active: boolean; passwordHash: string; createdAt: Date } | null> {
|
export async function GetUserByEmail(db: Db, args: { email: string }): Promise<{ id: number; email: string; name: string; active: boolean; passwordHash: string; createdAt: Date } | null> {
|
||||||
return (await db.one("SELECT * FROM users WHERE email = ?", [args.email], users)) as { id: number; email: string; name: string; active: boolean; passwordHash: string; createdAt: Date } | null;
|
return (await db.one("SELECT * FROM users WHERE email = $1", [args.email], users)) as { id: number; email: string; name: string; active: boolean; passwordHash: string; createdAt: Date } | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function ListUsers(db: Db): Promise<{ id: number; name: string; active: boolean }[]> {
|
export async function ListUsers(db: Db): Promise<{ id: number; name: string; active: boolean }[]> {
|
||||||
@@ -11,13 +11,13 @@ export async function ListUsers(db: Db): Promise<{ id: number; name: string; act
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function CountActive(db: Db, args: { active: boolean }): Promise<{ n: number } | null> {
|
export async function CountActive(db: Db, args: { active: boolean }): Promise<{ n: number } | null> {
|
||||||
return (await db.one("SELECT COUNT(*) AS n FROM users WHERE active = ?", [args.active])) as { n: number } | null;
|
return (await db.one("SELECT COUNT(*) AS n FROM users WHERE active = $1", [args.active])) as { n: number } | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function CreateUser(db: Db, args: { email: string; name: string; active: boolean }): Promise<ExecResult> {
|
export async function CreateUser(db: Db, args: { email: string; name: string; active: boolean }): Promise<ExecResult> {
|
||||||
return db.exec("INSERT INTO users (email, name, active) VALUES (?, ?, ?)", [args.email, args.name, args.active]);
|
return db.exec("INSERT INTO users (email, name, active) VALUES ($1, $2, $3)", [args.email, args.name, args.active]);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function DeactivateUser(db: Db, args: { id: number }): Promise<ExecResult> {
|
export async function DeactivateUser(db: Db, args: { id: number }): Promise<ExecResult> {
|
||||||
return db.exec("UPDATE users SET active = 0 WHERE id = ?", [args.id]);
|
return db.exec("UPDATE users SET active = 0 WHERE id = $1", [args.id]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user