kangdiandian / buildWhere

buildWhere

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

buildWhere

buildWhere 根据参数创建sql

  npm install buildwhere --save-dev
  yarn add buildwhere --dev
  const params = { id: '123', user_name: 'admin' };
  const whereArr = [
    {
      param: 'id',
      isLike: false,
    },
    {
      param: 'user_name',
      isLike: true,
      likeRule: 'all',
    },
  ];
  title = buildWhere('user', params, whereArr);
  // title = 'user."id"=123' AND user."user_name" LIKE '%admin%'

About

buildWhere


Languages

Language:JavaScript 100.0%