nxkit
Version:
This is a collection of tools, independent of any other libraries
64 lines (63 loc) • 1.53 kB
TypeScript
/// <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?: Connection): void;
}
export declare class Connection {
private _greeting;
private _socket;
private _idle_tomeout;
private _isUse;
private _isReady;
private _write;
private _sendAuth;
private _sendOldAuth;
private _clearTimeout;
private destroy;
/**
* option
* @type {Object}
*/
readonly options: Options;
readonly onError: EventNoticer<Event<Error, object>>;
readonly onPacket: EventNoticer<Event<Packet, object>>;
private readonly _onReady;
/**
* @constructor
* @arg opt {Object}
*/
constructor(options?: Options);
/**
* write buffer
* @arg {node.Buffer}
*/
write(buffer: Buffer): void;
/**
* return connection pool
*/
idle(): void;
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 Connection.resolve;