Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions codegen/FunctionsGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -889,11 +889,15 @@ function main(): void {
f => API_HEADERS.has(f.file) && !DISABLED_FAMILY_FUNCTIONS.has(f.name)
);

let cOut = fs.readFileSync(
// The marker banner is emitted here rather than stored in the source templates
// (which are hand-edited). Its text is assembled from parts so this generator is
// not itself flagged by tooling that scans for the marker.
const BANNER = '/* AUTO-GENERATED - DO NOT ' + 'EDIT. Run: npm run generate */\n';
let cOut = BANNER + fs.readFileSync(
path.resolve(__dirname, 'res/bindings_c_header.c.template'),
'utf-8'
);
let tsOut = fs.readFileSync(
let tsOut = BANNER + fs.readFileSync(
path.resolve(__dirname, 'res/functions_ts_header.ts.template'),
'utf-8'
);
Expand Down
14 changes: 13 additions & 1 deletion codegen/res/bindings_c_header.c.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* AUTO-GENERATED - DO NOT EDIT. Run: npm run generate */

#include <stdlib.h>
#include <postgres.h>
Expand Down Expand Up @@ -297,4 +296,17 @@ char * ttext_value_n_w(const Temporal *temp, int n) {
return text_to_cstring(r);
}

/*
* pg_interval_in — parse an interval string into a PostgreSQL Interval*.
* Declared in pgtypes.h (the PostgreSQL-compat layer), which is not among the
* public meos_*.h umbrella headers this preamble #includes; it is forward-
* declared here and its symbol resolves from libpgtypes.a at link time.
*/
extern Interval *pg_interval_in(const char *str, int32 typmod);

EMSCRIPTEN_KEEPALIVE
Interval * pg_interval_in_w(const char * str, int typmod) {
return pg_interval_in(str, typmod);
}

/* --- Generated wrappers --- */
19 changes: 15 additions & 4 deletions codegen/res/functions_ts_header.ts.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* AUTO-GENERATED - DO NOT EDIT. Run: npm run generate */
import { getModule } from '../runtime/meos';
import { getModule } from '../runtime/meos.js';

// WASM linear memory address, held as a JS number (safe up to 2^53).
export type Ptr = number;
Expand Down Expand Up @@ -51,8 +50,8 @@ export function callPtr(
// Typed exceptions (MeosInternalError, MeosInvalidArgError, …) are defined in
// src/errors.ts and dispatched via makeMeosException().

import { makeMeosException, MEOS_NOTICE, MEOS_WARNING, MeosException } from './errors';
export * from './errors';
import { makeMeosException, MEOS_NOTICE, MEOS_WARNING, MeosException } from './errors.js';
export * from './errors.js';

// MeosError kept as alias for backward compatibility.
export { MeosException as MeosError };
Expand Down Expand Up @@ -245,4 +244,16 @@ export function ttext_value_n(temp: Ptr, n: number): string | null {
return _r ?? null;
}

/*
* pg_interval_in — parse an interval string into a PostgreSQL Interval*.
* Declared in pgtypes.h (the PostgreSQL-compat layer), not a public MEOS
* umbrella header, so it is absent from the MEOS-API catalog (run.py ingests
* meos/include only) and is wrapped by hand. Pass typmod -1 for the default.
*/
export function pg_interval_in(str: string, typmod: number): Ptr {
const _r = callPtr('pg_interval_in_w', ['string', 'number'], [str, typmod]);
checkMeosError();
return _r;
}

// --- Generated wrappers ---
13 changes: 13 additions & 0 deletions core/c-src/bindings.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,19 @@ char * ttext_value_n_w(const Temporal *temp, int n) {
return text_to_cstring(r);
}

/*
* pg_interval_in — parse an interval string into a PostgreSQL Interval*.
* Declared in pgtypes.h (the PostgreSQL-compat layer), which is not among the
* public meos_*.h umbrella headers this preamble #includes; it is forward-
* declared here and its symbol resolves from libpgtypes.a at link time.
*/
extern Interval *pg_interval_in(const char *str, int32 typmod);

EMSCRIPTEN_KEEPALIVE
Interval * pg_interval_in_w(const char * str, int typmod) {
return pg_interval_in(str, typmod);
}

/* --- Generated wrappers --- */
/* === meos_error.h === */

Expand Down
18 changes: 15 additions & 3 deletions core/functions/functions.generated.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* AUTO-GENERATED - DO NOT EDIT. Run: npm run generate */
import { getModule } from '../runtime/meos';
import { getModule } from '../runtime/meos.js';

// WASM linear memory address, held as a JS number (safe up to 2^53).
export type Ptr = number;
Expand Down Expand Up @@ -51,8 +51,8 @@ export function callPtr(
// Typed exceptions (MeosInternalError, MeosInvalidArgError, …) are defined in
// src/errors.ts and dispatched via makeMeosException().

import { makeMeosException, MEOS_NOTICE, MEOS_WARNING, MeosException } from './errors';
export * from './errors';
import { makeMeosException, MEOS_NOTICE, MEOS_WARNING, MeosException } from './errors.js';
export * from './errors.js';

// MeosError kept as alias for backward compatibility.
export { MeosException as MeosError };
Expand Down Expand Up @@ -245,6 +245,18 @@ export function ttext_value_n(temp: Ptr, n: number): string | null {
return _r ?? null;
}

/*
* pg_interval_in — parse an interval string into a PostgreSQL Interval*.
* Declared in pgtypes.h (the PostgreSQL-compat layer), not a public MEOS
* umbrella header, so it is absent from the MEOS-API catalog (run.py ingests
* meos/include only) and is wrapped by hand. Pass typmod -1 for the default.
*/
export function pg_interval_in(str: string, typmod: number): Ptr {
const _r = callPtr('pg_interval_in_w', ['string', 'number'], [str, typmod]);
checkMeosError();
return _r;
}

// --- Generated wrappers ---

// === meos_error.h ===
Expand Down