UNPKG

nxkit

Version:

This is a collection of tools, independent of any other libraries

65 lines (64 loc) 1.55 kB
/// <reference types="node" /> import { EventNoticer, Event } from '../event'; import { Packet } from './parser'; import Constants from './constants'; import Charsets from './charsets'; import { Options } from '../db'; declare const _default: { MAX_CONNECT_COUNT: number; MAX_PACKET_SIZE: number; DEFAULT_FLAGS: Constants; CHAREST_NUMBER: Charsets; }; export default _default; interface Callback { (e: Error | null, connect?: Connect): void; } export declare class Connect { private _greeting; private _socket; private _tomeout; private _isUse; private _isReady; private _connectError; private _write; private _sendAuth; private _sendOldAuth; /** * option * @type {Object} */ readonly options: Options; readonly onError: EventNoticer<Event<Error, object>>; readonly onPacket: EventNoticer<Event<Packet, object>>; private readonly _onReady; /** * constructor function * @param {Object} opt * @constructor */ constructor(options?: Options); /** * write buffer * @param {node.Buffer} */ write(buffer: Buffer): void; /** * return connection pool */ idle(): void; private _destroy; private _changeDB; private _ready; /** * start use connect */ private _use; /** * get connect * @param {Object} opt * @param {Function} cb */ static resolve(opt: Options, cb: Callback): void; } export declare const resolve: typeof Connect.resolve;