@pgxsinkit/pgwasm
Version:
61 lines • 2.53 kB
TypeScript
/** A bind parameter: text, raw bytes (sent as binary), or SQL NULL. */
export type LegalValue = string | ArrayBuffer | ArrayBufferView | null;
declare function startup(opts: Record<string, string>): Uint8Array<ArrayBuffer>;
declare function requestSsl(): Uint8Array<ArrayBuffer>;
declare function password(value: string): Uint8Array<ArrayBuffer>;
declare function sendSASLInitialResponseMessage(mechanism: string, initialResponse: string): Uint8Array<ArrayBuffer>;
declare function sendSCRAMClientFinalMessage(additionalData: string): Uint8Array<ArrayBuffer>;
declare function query(text: string): Uint8Array<ArrayBuffer>;
export interface ParseOpts {
name?: string;
types?: readonly number[];
text: string;
}
declare function parse(opts: ParseOpts): Uint8Array<ArrayBuffer>;
type ValueMapper = (param: unknown, index: number) => LegalValue;
export interface BindOpts {
portal?: string;
binary?: boolean;
statement?: string;
values?: readonly LegalValue[];
/** Optional map from a JS value to the value sent, per parameter. */
valueMapper?: ValueMapper;
}
declare function bind(config?: BindOpts): Uint8Array<ArrayBuffer>;
export interface ExecOpts {
portal?: string;
rows?: number;
}
declare function execute(config?: ExecOpts): Uint8Array<ArrayBuffer>;
declare function cancel(processID: number, secretKey: number): Uint8Array<ArrayBuffer>;
export interface PortalOpts {
type: "S" | "P";
name?: string;
}
declare function describe(msg: PortalOpts): Uint8Array<ArrayBuffer>;
declare function close(msg: PortalOpts): Uint8Array<ArrayBuffer>;
declare function copyData(chunk: ArrayBuffer | ArrayBufferView): Uint8Array<ArrayBuffer>;
declare function copyFail(message: string): Uint8Array<ArrayBuffer>;
/** Frontend message builders. */
export declare const serialize: {
startup: typeof startup;
password: typeof password;
requestSsl: typeof requestSsl;
sendSASLInitialResponseMessage: typeof sendSASLInitialResponseMessage;
sendSCRAMClientFinalMessage: typeof sendSCRAMClientFinalMessage;
query: typeof query;
parse: typeof parse;
bind: typeof bind;
execute: typeof execute;
describe: typeof describe;
close: typeof close;
flush: () => Uint8Array<ArrayBuffer>;
sync: () => Uint8Array<ArrayBuffer>;
end: () => Uint8Array<ArrayBuffer>;
copyData: typeof copyData;
copyDone: () => Uint8Array<ArrayBuffer>;
copyFail: typeof copyFail;
cancel: typeof cancel;
};
export {};
//# sourceMappingURL=serializer.d.ts.map