serializer.d.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /// <reference types="node" />
  2. declare type ParseOpts = {
  3. name?: string;
  4. types?: number[];
  5. text: string;
  6. };
  7. declare type ValueMapper = (param: any, index: number) => any;
  8. declare type BindOpts = {
  9. portal?: string;
  10. binary?: boolean;
  11. statement?: string;
  12. values?: any[];
  13. valueMapper?: ValueMapper;
  14. };
  15. declare type ExecOpts = {
  16. portal?: string;
  17. rows?: number;
  18. };
  19. declare type PortalOpts = {
  20. type: 'S' | 'P';
  21. name?: string;
  22. };
  23. declare const serialize: {
  24. startup: (opts: Record<string, string>) => Buffer;
  25. password: (password: string) => Buffer;
  26. requestSsl: () => Buffer;
  27. sendSASLInitialResponseMessage: (mechanism: string, initialResponse: string) => Buffer;
  28. sendSCRAMClientFinalMessage: (additionalData: string) => Buffer;
  29. query: (text: string) => Buffer;
  30. parse: (query: ParseOpts) => Buffer;
  31. bind: (config?: BindOpts) => Buffer;
  32. execute: (config?: ExecOpts | undefined) => Buffer;
  33. describe: (msg: PortalOpts) => Buffer;
  34. close: (msg: PortalOpts) => Buffer;
  35. flush: () => Buffer;
  36. sync: () => Buffer;
  37. end: () => Buffer;
  38. copyData: (chunk: Buffer) => Buffer;
  39. copyDone: () => Buffer;
  40. copyFail: (message: string) => Buffer;
  41. cancel: (processID: number, secretKey: number) => Buffer;
  42. };
  43. export { serialize };