weifuwu 0.27.4 → 0.27.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,3 @@
1
1
  export { postgres, MIGRATIONS_TABLE } from './client.ts';
2
2
  export { PgModule } from './module.ts';
3
3
  export type { PostgresOptions, PostgresClient, PostgresInjected } from './types.ts';
4
- export * from './schema/index.ts';
@@ -1,13 +1,9 @@
1
- import type { PostgresClient } from './types.ts';
2
1
  import type { SqlClient, Closeable } from '../types.ts';
3
- import type { ColumnBuilder, BoundTable, Table } from './schema/index.ts';
2
+ import type { PostgresClient } from './types.ts';
4
3
  export declare class PgModule implements Closeable {
5
4
  protected sql: SqlClient;
6
5
  protected pg: PostgresClient;
7
6
  constructor(pg: PostgresClient);
8
- table<R extends Record<string, unknown>>(tableOrSchema: string | Table<R>, builders?: {
9
- [K in keyof R]: ColumnBuilder<R[K]>;
10
- }): BoundTable<R>;
11
7
  transaction<T>(fn: (sql: SqlClient) => Promise<T>, retryOpts?: {
12
8
  maxRetries?: number;
13
9
  }): Promise<T>;
@@ -1,5 +1,4 @@
1
1
  import type { SqlClient, Context, Middleware, Closeable } from '../types.ts';
2
- import type { ColumnBuilder, BoundTable, Table } from './schema/index.ts';
3
2
  declare module '../types.ts' {
4
3
  interface Context {
5
4
  sql: SqlClient;
@@ -29,12 +28,6 @@ export interface PostgresClient extends Middleware<Context, Context & PostgresIn
29
28
  markMigrated: (moduleName: string) => Promise<void>;
30
29
  /** Check whether a module has already been migrated. */
31
30
  isMigrated: (moduleName: string) => Promise<boolean>;
32
- table: {
33
- <R extends Record<string, unknown>>(tableName: string, builders: {
34
- [K in keyof R]: ColumnBuilder<R[K]>;
35
- }): BoundTable<R>;
36
- <R extends Record<string, unknown>>(schema: Table<R>): BoundTable<R>;
37
- };
38
31
  transaction: <T>(fn: (sql: any) => Promise<T>, retryOpts?: {
39
32
  maxRetries?: number;
40
33
  }) => Promise<T>;
@@ -0,0 +1,20 @@
1
+ import { Router } from '../core/router.ts';
2
+ import { type RawString } from './html.ts';
3
+ /**
4
+ * Create a Router that serves HTMX and Alpine.js at `/__wfw/js/`.
5
+ *
6
+ * ```ts
7
+ * app.use('/', assetRouter())
8
+ * ```
9
+ */
10
+ export declare function assetRouter(): Router;
11
+ /**
12
+ * Generate `<script>` tags for HTMX and Alpine, pointing to local paths.
13
+ *
14
+ * ```ts
15
+ * <head>
16
+ * ${assetScripts()}
17
+ * </head>
18
+ * ```
19
+ */
20
+ export declare function assetScripts(): RawString;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Load a `.ts` module with caching.
3
+ *
4
+ * - Modules are loaded once and cached indefinitely.
5
+ * - Concurrent calls for the same path share a single load promise.
6
+ * - Cache can be cleared for a specific path or entirely.
7
+ *
8
+ * @param path - Absolute or relative path to a `.ts` module.
9
+ * @returns The module exports.
10
+ */
11
+ export declare function loadModule<T = Record<string, unknown>>(path: string): Promise<T>;
12
+ /**
13
+ * Clear the module cache for a specific path or entirely.
14
+ *
15
+ * @param path - If provided, only clear this module. If omitted, clear all.
16
+ */
17
+ export declare function clearModuleCache(path?: string): void;
18
+ /**
19
+ * Get the number of cached modules (for testing/debugging).
20
+ */
21
+ export declare function cachedModuleCount(): number;
@@ -0,0 +1,16 @@
1
+ import { Router } from '../core/router.ts';
2
+ import type { Middleware } from '../types.ts';
3
+ export interface CssAsset {
4
+ css: string;
5
+ hash: string;
6
+ url: string;
7
+ }
8
+ declare module '../types.ts' {
9
+ interface Context {
10
+ css?: CssAsset;
11
+ }
12
+ }
13
+ export declare function compileCSS(cssPath: string, sourceDir: string): Promise<CssAsset>;
14
+ export declare function cssContext(dir: string): Middleware;
15
+ export declare function cssRouter(dir: string): Router;
16
+ export declare function clearCSSCache(): void;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * html — Tagged template literal for safe HTML rendering.
3
+ *
4
+ * Auto-escapes all interpolated values. Use {@link raw} to bypass escaping.
5
+ *
6
+ * ```ts
7
+ * import { html, raw } from 'weifuwu'
8
+ *
9
+ * const name = '<script>alert("xss")</script>'
10
+ * html`<h1>${name}</h1>`
11
+ * // → "<h1>&lt;script&gt;alert("xss")&lt;/script&gt;</h1>"
12
+ *
13
+ * html`<div>${raw('<b>safe</b>')}</div>`
14
+ * // → "<div><b>safe</b></div>"
15
+ * ```
16
+ */
17
+ /**
18
+ * Opaque marker returned by {@link raw} and {@link html}.
19
+ *
20
+ * Carries pre-escaped HTML that won't be double-escaped when nested
21
+ * in another {@link html} template. Has a {@link toString} for use
22
+ * in regular string contexts.
23
+ */
24
+ export interface RawString {
25
+ __brand: 'RawString';
26
+ value: string;
27
+ toString(): string;
28
+ }
29
+ /**
30
+ * Mark a string as pre-escaped HTML. The value will NOT be escaped
31
+ * when interpolated into an {@link html} template.
32
+ *
33
+ * ```ts
34
+ * html`<div>${raw(safeContent)}</div>`
35
+ * ```
36
+ */
37
+ export declare function raw(s: string): RawString;
38
+ /**
39
+ * Render a safe HTML string from a tagged template literal.
40
+ *
41
+ * - String values are HTML-escaped
42
+ * - {@link raw} values are inserted unescaped
43
+ * - Arrays are joined (supports `Array.map(() => html\`...\`)`)
44
+ * - `null` and `false` render as empty string
45
+ * - Numbers render as-is (they cannot contain HTML special chars)
46
+ *
47
+ * ```ts
48
+ * html`<h1>${title}</h1>`
49
+ * html`<ul>${items.map(i => html`<li>${i}</li>`)}</ul>`
50
+ * html`${isAdmin && html`<button>Admin</button>`}`
51
+ * ```
52
+ */
53
+ export declare function html(strings: TemplateStringsArray, ...values: unknown[]): RawString;
@@ -0,0 +1,2 @@
1
+ import type { Middleware } from '../types.ts';
2
+ export declare function layout(path: string): Middleware;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * view — Handler factory that renders a page template.
3
+ *
4
+ * Loads a `.ts` module and calls its **default export** function to
5
+ * produce an HTML response. The function can return:
6
+ * - A {@link RawString} (from `html()` or `raw()`)
7
+ * - A plain `string`
8
+ * - A `Response` (for redirects, custom status codes, etc.)
9
+ *
10
+ * ```ts
11
+ * // ui/app/page.ts
12
+ * export default function() {
13
+ * return html`<h1>Hello</h1>`
14
+ * }
15
+ *
16
+ * // Or with ctx access:
17
+ * export default function(ctx: Context) {
18
+ * return html`<h1>${ctx.params.slug}</h1>`
19
+ * }
20
+ *
21
+ * // Or for custom status:
22
+ * export default function(ctx) {
23
+ * if (!ctx.params.id) return new Response('Not Found', { status: 404 })
24
+ * return html`<h1>${ctx.params.id}</h1>`
25
+ * }
26
+ * ```
27
+ *
28
+ * @param path - Absolute or relative path to a `.ts` module.
29
+ * @returns A {@link Handler} that renders the page.
30
+ */
31
+ import type { Handler } from '../types.ts';
32
+ export interface ViewOptions {
33
+ /** Pre-loaded module (for production pre-build) */
34
+ module?: unknown;
35
+ }
36
+ export declare function view(path: string, options?: ViewOptions): Handler;
package/dist/types.d.ts CHANGED
@@ -9,6 +9,12 @@ export interface Context {
9
9
  params: Record<string, string>;
10
10
  query: Record<string, string>;
11
11
  mountPath?: string;
12
+ /**
13
+ * Server-side data loaded for the current page.
14
+ * Set by middleware before a page handler renders.
15
+ * Available in templates via `ctx.loaderData`.
16
+ */
17
+ loaderData?: Record<string, unknown>;
12
18
  [key: string]: unknown;
13
19
  }
14
20
  export type Handler<T extends Context = Context> = (req: Request, ctx: T) => Response | Promise<Response>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weifuwu",
3
3
  "type": "module",
4
- "version": "0.27.4",
4
+ "version": "0.27.6",
5
5
  "description": "Web-standard HTTP microframework for Node.js — (req, ctx) => Response",
6
6
  "exports": {
7
7
  ".": "./dist/index.js"
@@ -28,10 +28,15 @@
28
28
  "dependencies": {
29
29
  "@ai-sdk/openai": "^3.0.66",
30
30
  "@graphql-tools/schema": "^10",
31
+ "@tailwindcss/postcss": "^4",
31
32
  "ai": "^6",
33
+ "alpinejs": "^3",
32
34
  "graphql": "^16",
35
+ "htmx.org": "^2",
33
36
  "ioredis": "^5.11.0",
37
+ "postcss": "^8",
34
38
  "postgres": "^3.4.9",
39
+ "tailwindcss": "^4",
35
40
  "ws": "^8",
36
41
  "zod": "^4.4.3"
37
42
  },
package/dist/mailer.d.ts DELETED
@@ -1,51 +0,0 @@
1
- import { type Transporter } from 'nodemailer';
2
- import type { Closeable } from './types.ts';
3
- /** Options for sending an email. */
4
- export interface MailOptions {
5
- /** Recipient address(es). */
6
- to: string | string[];
7
- /** Email subject. */
8
- subject: string;
9
- /** Plain text body. */
10
- text?: string;
11
- /** HTML body. */
12
- html?: string;
13
- /** Sender address (overrides `MailerOptions.from`). */
14
- from?: string;
15
- /** CC recipient(s). */
16
- cc?: string | string[];
17
- /** BCC recipient(s). */
18
- bcc?: string | string[];
19
- }
20
- /** Options for {@link mailer}. */
21
- export interface MailerOptions {
22
- /** Nodemailer transport string or pre-built transporter object. */
23
- transport?: string | Transporter;
24
- /** Default sender address. */
25
- from?: string;
26
- /** Custom send function (bypasses nodemailer). */
27
- send?: (opts: MailOptions) => Promise<void>;
28
- }
29
- /** Mailer instance returned by {@link mailer}. */
30
- export interface Mailer extends Closeable {
31
- /** Send an email. */
32
- send: (opts: MailOptions) => Promise<void>;
33
- /** Close the nodemailer transport. */
34
- close: () => Promise<void>;
35
- }
36
- /**
37
- * Create a mailer instance.
38
- *
39
- * ```ts
40
- * import { mailer } from 'weifuwu'
41
- *
42
- * const email = mailer({ transport: 'smtp://user:pass@smtp.example.com' })
43
- * await email.send({
44
- * to: 'user@example.com',
45
- * subject: 'Hello',
46
- * text: 'Hello from weifuwu!',
47
- * })
48
- * await email.close()
49
- * ```
50
- */
51
- export declare function mailer(options: MailerOptions): Mailer;
@@ -1,99 +0,0 @@
1
- import { SQL } from './sql.ts';
2
- /** Reference to another table's column (foreign key). */
3
- export interface ColumnReference {
4
- /** Referenced table name. */
5
- table: string;
6
- /** Referenced column name (default: `'id'`). */
7
- column: string;
8
- /** `ON DELETE` action (e.g. `'cascade'`, `'set null'`). */
9
- onDelete?: string;
10
- }
11
- /**
12
- * Fluent column builder for DDL generation.
13
- *
14
- * ```ts
15
- * text('name').notNull().unique()
16
- * integer('user_id').references('users')
17
- * timestamptz('created_at').default(sql`NOW()`)
18
- * ```
19
- */
20
- export declare class ColumnBuilder<T> {
21
- /** Column name. */
22
- name: string;
23
- /** SQL type string (e.g. `'TEXT'`, `'INTEGER'`). */
24
- sqlType: string;
25
- /** Whether this column is PRIMARY KEY. */
26
- isPrimaryKey: boolean;
27
- /** Whether this column allows NULL. */
28
- isNullable: boolean;
29
- /** Whether this column has a UNIQUE constraint. */
30
- isUnique: boolean;
31
- /** Whether the value is auto-generated (e.g. SERIAL, UUID defaults). */
32
- isAutoGenerate: boolean;
33
- /** DEFAULT expression as a raw SQL string. */
34
- defaultExpr: string | null;
35
- /** Foreign key reference, if any. */
36
- ref: ColumnReference | null;
37
- constructor(name: string, sqlType: string);
38
- /** Mark as PRIMARY KEY (implies NOT NULL). */
39
- primaryKey(): this;
40
- /** Add NOT NULL constraint. */
41
- notNull(): this;
42
- /** Allow NULL values (default). */
43
- nullable(): this;
44
- /** Set a DEFAULT value. Accepts raw SQL, string, number, or boolean. */
45
- default(expr: SQL | string | number | boolean): this;
46
- /** Add UNIQUE constraint. */
47
- unique(): this;
48
- /** Add FOREIGN KEY reference to another table. */
49
- references(table: string, column?: string, onDelete?: string): this;
50
- }
51
- /** Auto-incrementing integer primary key (`SERIAL`). */
52
- export declare function serial(name: string): ColumnBuilder<number>;
53
- /** UUID column. */
54
- export declare function uuid(name: string): ColumnBuilder<string>;
55
- /** TEXT column. */
56
- export declare function text(name: string): ColumnBuilder<string>;
57
- /** INTEGER column. */
58
- export declare function integer(name: string): ColumnBuilder<number>;
59
- /** BOOLEAN column (exported as `boolean`). */
60
- export declare function boolean_(name: string): ColumnBuilder<boolean>;
61
- export { boolean_ as boolean };
62
- /** TIMESTAMPTZ column (timestamp with time zone). */
63
- export declare function timestamptz(name: string): ColumnBuilder<string>;
64
- /** JSONB column (stores arbitrary JSON data). */
65
- export declare function jsonb<T = unknown>(name: string): ColumnBuilder<T>;
66
- /** TEXT[] column (PostgreSQL array of text). */
67
- export declare function textArray(name: string): ColumnBuilder<string[]>;
68
- /** Vector column for pgvector (embedding storage). Requires `dimensions`. */
69
- export declare function vector(name: string, dims: number): ColumnBuilder<number[]>;
70
- export interface PartitionByDef {
71
- type: 'RANGE' | 'LIST' | 'HASH';
72
- column: string;
73
- }
74
- export declare function partitionBy(type: 'range' | 'list' | 'hash', column: string): PartitionByDef;
75
- /**
76
- * Create a pair of `created_at` / `updated_at` timestamp columns
77
- * that default to `NOW()` and are NOT NULL.
78
- *
79
- * ```ts
80
- * pgTable('users', {
81
- * id: serial('id').primaryKey(),
82
- * name: text('name'),
83
- * ...timestamps(),
84
- * })
85
- * ```
86
- */
87
- export declare function timestamps(): {
88
- readonly created_at: ColumnBuilder<string>;
89
- readonly updated_at: ColumnBuilder<string>;
90
- };
91
- /**
92
- * Convert a ColumnBuilder into a DDL column definition string.
93
- *
94
- * ```ts
95
- * toDDL(text('name').notNull())
96
- * // '"name" TEXT NOT NULL'
97
- * ```
98
- */
99
- export declare function toDDL(col: ColumnBuilder<unknown>): string;
@@ -1,6 +0,0 @@
1
- export { sql, SQL } from './sql.ts';
2
- export { ColumnBuilder, serial, uuid, text, integer, boolean as boolean, boolean_, timestamptz, jsonb, textArray, vector, toDDL, partitionBy, timestamps, } from './columns.ts';
3
- export type { PartitionByDef } from './columns.ts';
4
- export { pgTable, Table, BoundTable } from './table.ts';
5
- export type { IndexOptions, FindOptions, CreateOptions } from './table.ts';
6
- export { eq, ne, gt, gte, lt, lte, isNull, isNotNull, like, contains, in_, and, or, not, } from './where.ts';
@@ -1,22 +0,0 @@
1
- /**
2
- * A parameterized SQL fragment with template strings and bound values.
3
- * Used internally by the schema builder and where helpers.
4
- */
5
- export declare class SQL {
6
- /** Template string parts (interleaved with values). */
7
- strings: TemplateStringsArray;
8
- /** Bound parameter values. */
9
- values: unknown[];
10
- constructor(strings: TemplateStringsArray, values: unknown[]);
11
- /** Serialize to a raw SQL string (interpolating values inline for DDL use). */
12
- toSQL(): string;
13
- }
14
- /**
15
- * Tagged template helper for creating parameterized SQL fragments.
16
- *
17
- * ```ts
18
- * sql`NOW()`
19
- * sql`${column} ILIKE ${'%' + search + '%'}`
20
- * ```
21
- */
22
- export declare function sql(strings: TemplateStringsArray, ...values: unknown[]): SQL;
@@ -1,141 +0,0 @@
1
- import type { SqlClient } from '../../types.ts';
2
- import { ColumnBuilder, type PartitionByDef } from './columns.ts';
3
- import { SQL } from './sql.ts';
4
- /** Options for table index creation. */
5
- export interface IndexOptions {
6
- /** Whether the index should be UNIQUE. */
7
- unique?: boolean;
8
- /** Index type: btree (default), hnsw (pgvector), gin (JSONB). */
9
- type?: 'btree' | 'hnsw' | 'gin';
10
- /** Create index in DESC order. */
11
- desc?: boolean;
12
- /** Custom operator class (e.g. `vector_cosine_ops`). */
13
- operator?: string;
14
- }
15
- /** Options for CREATE TABLE. */
16
- export interface CreateOptions {
17
- /** Partition by clause (RANGE, LIST, or HASH). */
18
- partitionBy?: PartitionByDef;
19
- }
20
- /** Options for find/read queries. */
21
- export interface FindOptions {
22
- /** ORDER BY clause: `{ column: 'asc' | 'desc' }`. */
23
- orderBy?: Record<string, 'asc' | 'desc'>;
24
- /** LIMIT. */
25
- limit?: number;
26
- /** OFFSET. */
27
- offset?: number;
28
- /** Columns to SELECT (default: all). */
29
- select?: string[];
30
- /** Include soft-deleted rows (also sets `withDeleted` context). */
31
- withDeleted?: boolean;
32
- }
33
- /**
34
- * Type-safe table schema + CRUD operations.
35
- *
36
- * Create an instance with {@link pgTable}, then call `.bind(sql)` to get a
37
- * `BoundTable` for running queries.
38
- *
39
- * ```ts
40
- * const users = pgTable('users', {
41
- * id: serial('id').primaryKey(),
42
- * name: text('name').notNull(),
43
- * email: text('email').unique(),
44
- * })
45
- *
46
- * const db = users.bind(sql)
47
- * await db.create()
48
- * await db.insert({ name: 'Alice', email: 'a@b.com' })
49
- * const row = await db.findBy({ email: 'a@b.com' })
50
- * ```
51
- */
52
- export declare class Table<R extends Record<string, unknown>> {
53
- /** Database table name. */
54
- readonly tableName: string;
55
- /** All column builders (order-preserving). */
56
- readonly columns: ColumnBuilder<unknown>[];
57
- /** Column builders keyed by property name. */
58
- readonly builders: Record<string, ColumnBuilder<unknown>>;
59
- private colEntries;
60
- constructor(tableName: string, builders: Record<string, ColumnBuilder<unknown>>);
61
- /** Check if the table has a column with the given DB name. */
62
- hasColumn(dbName: string): boolean;
63
- /**
64
- * Bind this table schema to a SQL connection, returning a `BoundTable`
65
- * that can run queries without passing `sql` to every call.
66
- */
67
- bind(sql: SqlClient): BoundTable<R>;
68
- /** Returns the primary key column name (DB name), or 'id' as fallback. */
69
- private get pkColumn();
70
- /** Adds `deleted_at IS NULL` condition if the table has soft delete and not explicitly excluded. */
71
- private _softDeleteFilter;
72
- create(sql: SqlClient, opts?: CreateOptions): Promise<void>;
73
- drop(sql: SqlClient, opts?: {
74
- cascade?: boolean;
75
- }): Promise<void>;
76
- createIndex(sql: SqlClient, columns: string | string[], opts?: IndexOptions): Promise<void>;
77
- createUniqueIndex(sql: SqlClient, columns: string | string[]): Promise<void>;
78
- private _buildConditions;
79
- private _buildSET;
80
- insert(sql: SqlClient, data: Partial<R>): Promise<R>;
81
- insertMany(sql: SqlClient, data: Partial<R>[]): Promise<R[]>;
82
- read(sql: SqlClient, id: string | number, opts?: Pick<FindOptions, 'select' | 'withDeleted'>): Promise<R | undefined>;
83
- readMany(sql: SqlClient, where?: Partial<R> | SQL | SQL[], opts?: FindOptions): Promise<{
84
- count: number;
85
- data: R[];
86
- }>;
87
- update(sql: SqlClient, id: string | number, data: Partial<R>): Promise<R | undefined>;
88
- updateMany(sql: SqlClient, where: Partial<R> | SQL | SQL[], data: Partial<R>): Promise<number>;
89
- delete(sql: SqlClient, id: string | number): Promise<R | undefined>;
90
- hardDelete(sql: SqlClient, id: string | number): Promise<R | undefined>;
91
- deleteMany(sql: SqlClient, where: Partial<R> | SQL | SQL[]): Promise<number>;
92
- hardDeleteMany(sql: SqlClient, where: Partial<R> | SQL | SQL[]): Promise<number>;
93
- upsert(sql: SqlClient, data: Partial<R>, conflict: string | string[]): Promise<R>;
94
- count(sql: SqlClient, where?: Partial<R> | SQL | SQL[]): Promise<number>;
95
- }
96
- export declare class BoundTable<R extends Record<string, unknown>> {
97
- private inner;
98
- private sql;
99
- /** The underlying table name. */
100
- get tableName(): string;
101
- constructor(sql: SqlClient, tableName: string, builders: Record<string, ColumnBuilder<unknown>>);
102
- create(opts?: CreateOptions): Promise<void>;
103
- drop(opts?: {
104
- cascade?: boolean;
105
- }): Promise<void>;
106
- createIndex(columns: string | string[], opts?: IndexOptions): Promise<void>;
107
- createUniqueIndex(columns: string | string[]): Promise<void>;
108
- insert(data: Partial<R>): Promise<R>;
109
- insertMany(data: Partial<R>[]): Promise<R[]>;
110
- read(id: string | number, opts?: Pick<FindOptions, 'select' | 'withDeleted'>): Promise<R | undefined>;
111
- readMany(where?: Partial<R> | SQL | SQL[], opts?: FindOptions): Promise<{
112
- count: number;
113
- data: R[];
114
- }>;
115
- update(id: string | number, data: Partial<R>): Promise<R | undefined>;
116
- updateMany(where: Partial<R> | SQL | SQL[], data: Partial<R>): Promise<number>;
117
- delete(id: string | number): Promise<R | undefined>;
118
- hardDelete(id: string | number): Promise<R | undefined>;
119
- deleteMany(where: Partial<R> | SQL | SQL[]): Promise<number>;
120
- hardDeleteMany(where: Partial<R> | SQL | SQL[]): Promise<number>;
121
- upsert(data: Partial<R>, conflict: string | string[]): Promise<R>;
122
- count(where?: Partial<R> | SQL | SQL[]): Promise<number>;
123
- withSql(sql: SqlClient): BoundTable<R>;
124
- }
125
- /**
126
- * Define a type-safe table schema.
127
- *
128
- * ```ts
129
- * const users = pgTable('users', {
130
- * id: serial('id').primaryKey(),
131
- * name: text('name').notNull(),
132
- * email: text('email').unique(),
133
- * })
134
- *
135
- * // The generic type R preserves the column types:
136
- * // Table<{ id: number; name: string; email: string }>
137
- * ```
138
- */
139
- export declare function pgTable<R extends Record<string, unknown>>(tableName: string, builders: {
140
- [K in keyof R]: ColumnBuilder<R[K]>;
141
- }): Table<R>;
@@ -1,29 +0,0 @@
1
- import { SQL } from './sql.ts';
2
- /** Column equals value: `col = val`. */
3
- export declare function eq(col: string, val: unknown): SQL;
4
- /** Column not equals value: `col != val`. */
5
- export declare function ne(col: string, val: unknown): SQL;
6
- /** Column greater than value: `col > val`. */
7
- export declare function gt(col: string, val: unknown): SQL;
8
- /** Column greater than or equal value: `col >= val`. */
9
- export declare function gte(col: string, val: unknown): SQL;
10
- /** Column less than value: `col < val`. */
11
- export declare function lt(col: string, val: unknown): SQL;
12
- /** Column less than or equal value: `col <= val`. */
13
- export declare function lte(col: string, val: unknown): SQL;
14
- /** Column IS NULL. */
15
- export declare function isNull(col: string): SQL;
16
- /** Column IS NOT NULL. */
17
- export declare function isNotNull(col: string): SQL;
18
- /** Column LIKE pattern. */
19
- export declare function like(col: string, pattern: string): SQL;
20
- /** Negate a condition: `NOT (condition)`. */
21
- export declare function not(condition: SQL): SQL;
22
- /** JSONB containment: `col @> val` (does `col` contain `val`?). */
23
- export declare function contains(col: string, val: Record<string, unknown>): SQL;
24
- /** Column value is in array: `col = ANY(val)`. */
25
- export declare function in_(col: string, val: unknown[]): SQL;
26
- /** Combine conditions with AND. */
27
- export declare function and(...conditions: SQL[]): SQL;
28
- /** Combine conditions with OR. */
29
- export declare function or(...conditions: SQL[]): SQL;