0.4.1 • Published 2 years ago

happysmile_utils v0.4.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Info

this is a set of utils function that I used often,now I added it to a Utils class. for future,it will add more function. 这是一个我平常经常用到的工具集,现在正在不断地往里添加功能。预计未来会添加更多函数。

usage:用法:

import Utils from "./es6/Utils.js";
console.log(Utils.randomColor(Utils.PARAM.RANDOM_COLOR_STYLE_SHARP));
console.log(Utils.randomColor(Utils.PARAM.RANDOM_COLOR_STYLE_RGB));
console.log(Utils.randomColor(Utils.PARAM.RANDOM_COLOR_STYLE_RGBA));
console.log(Utils.verfifyCode());
var queryString = Utils.objToQueryString({
  obj: { a: { e: 4, f: [3, 4, 5, 56, 3, 2, , 2] }, b: 2, c: 3 },
  isEncode: false,
});
console.log(queryString);
console.log(
  Utils.queryStringToObject({ queryStr: queryString, isDecode: false }),
);

import 导入方式

support commonJS & es6 import. commonJS in commonjs directory

提供了commonJS和es6导入。commonJS在commonJS目录

es6;
import Utils from "./es6/Utils.js";

commonJS;
const Utils = require("./commonJS/Utils");

mysql

const MySQL = require("./commonJS/db/MySQL");
var mysql;
start();
async function start() {
  mysql = new MySQL();
  await mysql.init();
  // await mysql.insert({
  //     _table_name: 'user',
  //     _add_dto: {
  //         user: 'guozi23n5',
  //         password: '123',
  //         name: '诸葛亮4',
  //         sex: '男',
  //         age: 133,
  //         tel: '13232343',
  //         email: '233223@qq.com'
  //     }
  // })
  // await mysql.update({
  //     _table_name: 'user',
  //     _select_dto: {
  //         user: 'guozi23n5',
  //     },
  //     _update_dto: {
  //         age: 1,
  //     }
  // })
  // });
  // await mysql.delete({
  //     _table_name: 'user',
  //     _delete_dto: {
  //         name: '232333223',
  //     }
  // })

  var selectALL = await mysql.select({
    _table_name: "user",
  });

  console.log(selectALL);
}
0.4.1

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.2

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago