UNPKG

access-db

Version:

[统一数据库的连接]Unified access to all kinds of databases

28 lines (27 loc) 715 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.strHash = void 0; const process_1 = require("process"); const word = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' ]; // 以hrTime为随机的hash hrtime.bigint(); function timeHash() { let hrt = process_1.hrtime.bigint(); let hash = ''; let str = `${hrt}`; for (let i = 0; i < str.length; i++) { hash += word[str[i]] || 'x'; } return hash; } exports.default = timeHash; // fastdb 新增时的随机id const strHash = () => { let hrt = process_1.hrtime.bigint(); let nowTime = new Date().getTime(); let s = `${nowTime}${hrt}`; return s; }; exports.strHash = strHash;