pg-server
Version:
Postgres DB server emulator, proxy or honeypot
78 lines • 1.84 kB
TypeScript
/// <reference types="node" />
export interface IProxiedServer {
/** Sends a raw buffer to server */
sendRaw(raw: Buffer): void;
/** Just forward the statement */
send(command: DbCommand): void;
}
export type DbCommand = Init | Parse | Bind | StartupMD5 | PortalOp | CopyFail | CopyFromChunk | Execute | Query | CodeOnlyCommand;
export declare enum CommandCode {
init = 0,
startup = 112,
query = 81,
parse = 80,
bind = 66,
execute = 69,
flush = 72,
sync = 83,
end = 88,
close = 67,
describe = 68,
copyFromChunk = 100,
copyDone = 99,
copyFail = 102
}
export interface Init {
type: CommandCode.init;
version: {
minor: number;
major: number;
};
options: {
[key: string]: string;
};
}
export interface StartupMD5 {
type: CommandCode.startup;
md5: string;
}
export interface Parse {
type: CommandCode.parse;
queryName: string;
query: string;
parameters: number[];
}
export interface Bind {
type: CommandCode.bind;
portal: string;
statement: string;
values: any[];
binary: boolean;
}
export interface PortalOp {
type: CommandCode.describe | CommandCode.close;
portalType: 'P' | 'S';
name?: string;
}
export interface Execute {
type: CommandCode.execute;
portal: string;
rows: number;
}
export interface CodeOnlyCommand {
type: CommandCode.flush | CommandCode.sync | CommandCode.end | CommandCode.copyDone;
}
export interface Query {
type: CommandCode.query;
query: string;
}
export interface CopyFail {
type: CommandCode.copyFail;
message: string;
}
export interface CopyFromChunk {
type: CommandCode.copyFromChunk;
buffer: Buffer;
}
export declare function commandToStr(code: CommandCode): any;
//# sourceMappingURL=commands.d.ts.map