{"id":15625868,"url":"https://github.com/brainpoint/febs-db","last_synced_at":"2026-03-02T18:40:30.147Z","repository":{"id":57199023,"uuid":"62538950","full_name":"brainpoint/febs-db","owner":"brainpoint","description":"a orm library for nodejs","archived":false,"fork":false,"pushed_at":"2025-05-18T16:28:09.000Z","size":212,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-23T22:08:53.569Z","etag":null,"topics":["count","database","db","mssql","mysql","nodejs","orm","sql","sqlserver","transaction"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brainpoint.png","metadata":{"files":{"readme":"README-v0.0.3.md","changelog":"HISTORY.citong-db.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-07-04T06:59:28.000Z","updated_at":"2025-05-18T16:28:12.000Z","dependencies_parsed_at":"2025-04-04T10:21:22.002Z","dependency_job_id":"0f0fc6a8-a77b-434e-b55d-b272bc06a25d","html_url":"https://github.com/brainpoint/febs-db","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/brainpoint/febs-db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainpoint%2Ffebs-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainpoint%2Ffebs-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainpoint%2Ffebs-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainpoint%2Ffebs-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brainpoint","download_url":"https://codeload.github.com/brainpoint/febs-db/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brainpoint%2Ffebs-db/sbom","scorecard":{"id":250735,"data":{"date":"2025-08-11","repo":{"name":"github.com/brainpoint/febs-db","commit":"f59a99f4f98ea7d3b1e0cb8e7b13c7df6431e769"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Maintained","score":0,"reason":"1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T08:24:49.212Z","repository_id":57199023,"created_at":"2025-08-17T08:24:49.212Z","updated_at":"2025-08-17T08:24:49.212Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30014932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T17:00:27.440Z","status":"ssl_error","status_checked_at":"2026-03-02T17:00:03.402Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["count","database","db","mssql","mysql","nodejs","orm","sql","sqlserver","transaction"],"created_at":"2024-10-03T10:07:08.018Z","updated_at":"2026-03-02T18:40:30.100Z","avatar_url":"https://github.com/brainpoint.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"febs db库用于连接数据库,目前仅支持mysql\n\n`febs-db是在citong-db@1.5.3基础上进行开发, citong-db库已停止更新`\n\n- [Install](#install)\n- [Exception](#exception)\n- [1.Define Table](#define-table)\n- [2.Connect db](#connect-db)\n- [3.Manipulate db](#manipulate-db)\n- [Class database](#database)\n- [Class table](#table)\n\n# Install\n\nUse npm to install:\n\n```js\nnpm install febs-db --save\n```\n![](doc/framework.png)\n\n febs-db是一个orm库, 3个主要的类为:\n\n\u003e `database`: 代表一个数据库; 可以用于创建新的数据库连接对象`database-connection`进行事务等操作.\n\n\u003e `table`: 代表一个数据库表; 针对表的操作在这个对象中完成\n\n\u003e `database_connection`: 表示一个连接对象, 在执行事务操作时, 需要使用database来向连接池中获取一个连接来进行.\n\n\n# Exception\n\n在错误发生时会抛出`exception`类型的异常\n\n事务处理中发生异常将自动rollback.\n\n定义了常用的错误代码.\n\n```js\n// @desc: 数据查询条件错误。参数语句问题.\nexception.DB_ERROR_SQL\n// @desc: 数据连接问题.\nexception.DB_ERROR_CONNECT\n// @desc: 数据执行错误.\nexception.DB_ERROR\n```\n\n异常类如下\n```js\n/**\n* @desc: 构造异常对象.\n* @param msg: 异常消息\n* @param code: 异常代码\n* @param filename: 异常文件名\n* @param line: 异常文件所在行\n* @return: \n*/\nexception(msg, code, filename, line)\n```\n例子:\n```js\nvar exception = require('.').exception;\ntry {\n  yield db.queryById(...);\n} catch (e) {\n  if (e instanceof exception) {\n    // e.code == exception.DB_ERROR_SQL, 查询语句错误.\n  } else {\n    throw e;\n  }\n}\n```\n\n# Define-table\n\n操作一个数据表之前, 需要先对表结构进行定义, 与数据不匹配的定义在执行数据操作时会报错. 数据列可以仅列出需要操作的列.\n\n```js\nvar table   = require('.').table;\n\nclass TableDemo extends table {\n  constructor(db) {\n    super(\n      db,       // database\n      'User',   // table name.\n      'ID',     // primary key.\n      {         // cols.\n        ID:       {type: 'integer', size: 8, key: true}, // the auto-incrementing\n        Name:     {type: 'text',    size:10},\n        NumberCol:{type: 'number',  size: 4},\n        IntCol:   {type: 'integer', size: 4},\n        IntCol:   {type: 'integer', size: 8}, // big int.\n        BoolCol:  {type: 'boolean'}\n      }\n    );\n  }\n}\n```\n## example:\n```js\nvar database  = require('febs-db').database;\n\nvar db = new database({});\nvar tableDemo = new TableDemo(db);\n```\n\n## combined primary key\n\n```js\nvar table   = require('.').table;\n\nclass TableDemo extends table {\n  constructor(dbclient) {\n    super(\n      dbclient, // database\n      'Admin',  // table name.\n      ['ID', 'IntCol'],     // primary keys.\n      {         // cols.\n        ID:       {type: 'integer', size: 8, key: true},  // the auto-incrementing\n        Name:     {type: 'text',    size:10},\n        NumberCol:{type: 'number',  size: 4},\n        IntCol:   {type: 'integer', size: 4},\n        IntCol:   {type: 'integer', size: 8}, // big int.\n        BoolCol:  {type: 'boolean'}\n      }\n    );\n  }\n}\n```\n\n# Connect-db\n\nmysql: see [mysql](https://www.npmjs.com/package/mysql#pool-options) pool-options.\n\n```js\nvar database = require('febs-db').database;\n\nvar opt = {\n  waitForConnections: true,\n  connectTimeout    : 5000,\n  acquireTimeout    : 5000,\n  queueLimit        : 20,\n  connectionLimit   : 10,\n  supportBigNumbers : true,\n  bigNumberStrings  : false,  // number -\u003e string only when number overflow in js.\n  host              : '',\n  port              : 3306,\n  user              : '',\n  password          : '',\n  database          : '',\n  /* ext */\n  queryTimeout      : 5000,\n};\n\nvar db = new database('mysql', opt);\nvar table = new TableDemo(db);\n```\n\n# Manipulate-db\n\n数据操作方法都存在同步方式和异步方式, 例如: `table.isExist()` 和 `table.isExistSync()`\n所有的同步方式方法都是在末尾加上`Sync`\n\n- [exist](#exist)\n- [query](#query)\n- [query-Lock-Row](#query-lock-row)\n- [count](#count)\n- [add](#add)\n- [update](#update)\n- [remove](#remove)\n- [transaction](#transaction)\n\n## exist\n\n```js\nlet r;\n// async.\nr = yield table.isExist(1);\nr = yield table.isExist({ID:1,Name:'xxx'});    // combined primary key.\nr = yield table.isExistWhere(\"id=43\");\n// sync.\nr = yield table.isExistSync(1, (err, r)=\u003e{});\nr = yield table.isExistWhereSync(\"id=43\", (err, r)=\u003e{});\n```\n\n## query\n\n```js\nlet r;\n// 通过主键查询.\nr = yield table.queryById(1);\nr = yield table.queryById(1, ['ID','Name']);      // only query 'ID','Name' cols.\nr = yield table.queryById({ID:1,IntCol:1}, ['ID','Name']);  // if combined primary key.\n\n// top.\nr = yield table.queryTop(\"id = 43\");\nr = yield table.queryTop(\"id = 43\", ['ID','Name']);  // only query 'ID','Name' cols.\n\n// 条件查询. 使用make_condition_xxx 方法构造条件, 能够自动检查数值类型.\nlet where = '';\nwhere += table.make_condition('id', 43); // == \" `id`=43 \".\nwhere += 'AND';\nwhere += table.make_condition_like('name', '%dfdfd%'); // == \" `name` LIKE '%dfdfd%' \".\nr = yield table.queryTop(where);\n\nr = yield table.queryWhere(where, [0, 100], {ID:true});       // where id = 43 limit 0,100 order by id asc.\nr = yield table.queryWhere(where, ['ID', 'Name']);            // only query 'ID','Name' cols.\nr = yield table.queryWhere(where, [0, 100],  ['ID', 'Name']); // only query 'ID','Name' cols. limit 0,100\nr = yield table.queryWhere(where, {ID:true}, ['ID', 'Name']); // only query 'ID','Name' cols. orderby ID\nr = yield table.queryWhere(where, ['COUNT(ID) as x']);\n```\n\n\n## query-lock-row\n\n锁行方式查询, 只能在事务中使用此方式. 在事务结束或update之后自动解锁.\n\n`queryLockRow`方法的参数与`queryById`方法相同\n\n```js\n// 获取一个新连接用于事务执行.\nvar conn = yield db.getConnection();\nif (conn)\n{\n  // 执行事务\n  return yield conn.transaction(function*(){\n\n    // lock row id = 1, and unlock after update or exit transaction.\n    let r;\n    r = yield table.queryLockRow(1, conn);\n    // or.\n    r = yield table.queryLockRow(1, ['col1','col2'], conn);\n\n    return false; // will rollback.\n    return true;  // will commit.\n  });\n}\n```\n\n## count\n\n```js\nlet r;\nlet where = table.make_condition('id', 43); // == \" `id`=43 \".\nr = yield table.count(where);\n```\n\n## add\n\n```js\nvar r = yield table.add({ID:8,...});\n```\n\n## update\n\n更新方法需传入一个对象, 其中必须附带`主键`, 执行后将更新其他在参数中的其他数据.\n\n```js\nvar mod = {\n  ID:     1,\n  name:   \"name\",\n  intCol: table.make_update_inc(1),\n  intCol2:table.make_origin_sql('`intCol2`+1')\n};\nvar r = yield table.update(mod);  // ID=1,name=\"name\",intCol=intCol+1,intCol2=intCol2+1\n```\n\n## remove\n\n```js\nvar r = yield table.remove(where);\n```\n\n## transaction\n\n* 执行事务需要一个独立的连接对象 `datdatabase_connection`, 事务完成后连接对象将重新被插入到连接池中.\n* 事务处理函数中, 所有的事务数据库操作方法都必须在最后带上这个`连接对象`\n* 事务处理函数中, 返回`false` 将`rollback`, 返回`true`将`commit`\n* 若发生异常, 事务将自动`rollback`.\n* *事务嵌套调用未处理, 将在下一版本添加\n\n```js\n// 获取一个新的连接用于事务执行.\nvar conn = yield db.getConnection();\nif (conn)\n{\n  // 执行事务, 错误将返回false;\n  return yield conn.transaction(function*(){\n    // attach conn.\n    console.log((yield table.add(mod, conn)));\n\n    mod.id = 1;\n    mod.name = 'a1';\n    console.log((yield table.update(mod, conn)));\n\n    return false; // will rollback.\n    return true;  // will commit.\n  });\n}\n```\n\n# database\n\n## 构造\n\n```js\n/*\n* 构造\n*/\nconstructor(dbtype, opt)\n```\n* dbtype: 数据库类型, 目前仅能为 `'mysql'`\n* opt: 连接参数\n\nmysql: see [mysql](https://www.npmjs.com/package/mysql#pool-options) pool-options.\n```js\nvar opt = {\n  waitForConnections: true,\n  connectTimeout    : 5000,\n  acquireTimeout    : 5000,\n  queueLimit        : 20,\n  connectionLimit   : 10,\n  supportBigNumbers : true,\n  bigNumberStrings  : false,  // number -\u003e string only when number overflow in js.\n  host              : '',\n  port              : 3306,\n  user              : '',\n  password          : '',\n  database          : '',\n  /* ext */\n  queryTimeout      : 5000,\n};\n```\n## 方法\n```js\n/**\n* @desc: 执行sql语句.\n* @param values: 传递的参数.\n* @return: 错误返回false. 正确返回结果.\n*/\n*query(sql, values, conn)\n/**\n* @param cb: cb(err, ret)  {}\n* @param values: 传递的参数.\n* @return: void\n*/\nquerySync( sql, value, cb, conn )\n```\n\n## 获取连接\n\n从连接池中获取一个空闲的连接用于事务处理.\n```js\n/**\n  * @desc: get the connection for transaction.\n  * @return: database_connection.\n  */\n*getConnection() // * 表明此方法是一个异步方法\n```\n\n# table\n\n所有的数据库查询方法都存在相应的同步调用方式, 如: queryWhereSync();\n\n- [constructor](#table-constructor)\n- [getConnection](#table-getconnection)\n- [isExist](#table-isexist)\n- [isExistWhere](#table-isexistwhere)\n- [count](#table-count)\n- [add](#table-add)\n- [remove](#table-remove)\n- [update](#table-update)\n- [queryById](#table-querybyid)\n- [queryLockRow](#table-querylockrow)\n- [queryTop](#table-querytop)\n- [queryWhere](#table-querywhere)\n- [get_conn](#table-get_conn)\n- [escape](#table-escape)\n\n构造查询条件相关方法\n- [make_condition](#table-make-condition)\n- [make_condition_not_equal](#table-make-condition-not-equal)\n- [make_condition_more](#table-make-condition-more)\n- [make_condition_more_equal](#table-make-condition-more-equal)\n- [make_condition_less_equal](#table-make-condition-less-equal)\n- [make_condition_less](#table-make-condition-less)\n- [make_condition_like](#table-make-condition-like)\n- [make_update_inc](#table-make-update-inc)\n- [make_origin_sql](#table-make-origin-sql)\n\n\n### table-constructor\n```js\n/**\n* @param db: 数据库对象.\n* @param tablename: 本表名.\n* @param idKeyName: 本表主键列表, 如果为单主键可以直接为字符串, 如果为联合多主键则需要为数组.\n* @param model: 本表模型.\n*/\n*constructor(db, tablename, idKeyName, model)\n```\n\n\u003e `model`的定义格式如下:\n\n\u003e {\u003cbr\u003e\n    colName: {`type`: 'integer', `size`: 8, `key`: true}, // the auto-incrementing\u003cbr\u003e\n    ...\u003cbr\u003e\n  }\n\n- `colName`: 表示列名称\n- `type`: 表示列类型\n\n  | 类型 | 说明 | size |\n  |------|--------|----|\n  | 'integer' | 整型  | 指明字节长度 |\n  | 'text' | 字符串   | 指明字符长度 |\n  | 'number' | 浮点型 | 指明字节长度 |\n  | 'boolean' | 布尔型| 无意义 |\n\n- `size`: 字段长度(字节长度), 例如: bigint 长度为8, int长度为4.\n- `key`:  是否是自增键; (同一个表只能有一个自增键, 当指定多个自增键时, 只认为最后一个为自增)\n\n### table-getConnection\n\n```js\n/**\n  * @desc: get a new connection for transaction.\n  * @return: database_connection.\n  */\n*getConnection() // * 表明此方法是一个异步方法\n```\n\n### table-isExist\n\n```js\n/**\n* @desc: isExist\n*         id is Object if table is combined primary. \n*         the last param can be conn.\n* @return: boolean.\n*/\n*isExist( id )\n/**\n* @desc: isExist\n*         id is Object if table is combined primary. \n*         the last param can be conn.\n* @param id, cb\n*         - cb: function(err, r:boolean)  {}\n*/\nisExistSync( id, cb )\n```\n\n### table-isExistWhere\n\n```js\n/**\n* @desc: isExitWhere\n*         the last param can be conn.\n* @return: boolean.\n*/\n*isExistWhere( where )\n/**\n* @desc: isExitWhere\n*         the last param can be conn.\n* @param where, cb\n*         - cb: function(err, r:boolrean)  {}\n*/\nisExistWhereSync()\n```\n\n### table-count\n\n```js\n/**\n* @desc: count\n*         the last param can be conn.\n* @param: where\n* @return: int.\n*/\n*count()\n/**\n* @desc: count\n*         the last param can be conn.\n* @param: where, cb\n*           - cb: function(err, ret:int)  {}\n*/\ncountSync()\n```\n\n### table-add\n\n```js\n/**\n* @desc: add\n*         the last param can be conn.\n*         (insertId will set to item.id)\n* @return: bool\n*/\n*add( item )\n/**\n* @param cb: cb(err, r:boolean)  {}\n* @return: void\n*/\naddSync( item, cb )\n```\n\n### table-remove\n\n```js\n/**\n* @desc: remove\n*         the last param can be conn.\n* @return: bool.\n*/\n*remove( where )\n/**\n* @param cb: cb(err, r:boolean)  {}\n* @return:.\n*/\nremoveSync( where, cb )\n```\n\n### table-update\n\n```js\n/**\n* @desc: update;  where id = item.id\n*         if item.id is existed, sql condition is: 'id=value' AND (where)\n*         otherwise sql condition is: where \n*         the last param can be conn.\n* @param item, where.\n* @return: boolean.\n*/\n*update( item )\n/**\n* @desc: update;  where id = item.id\n*         if item.id is existed, sql condition is: 'id=value' AND (where)\n*         otherwise sql condition is: where \n*         the last param can be conn.\n* @param item, where, cb.\n*         - cb: function(err, r:boolrean) {}\n* @return:.\n*/\nupdateSync( item )\n```\n\n### table-queryById\n\n```js\n/**\n* @desc: query by id.\n*         id is Object if table is combined primary. \n*         the last param can be conn.\n* @param: id, [query_cols]\n*           query_cols: [col1,col2], the cols will be query.\n* @return: mod.\n*/\n*queryById( id )\n/**\n* @desc: query by id.\n*         id is Array if table is combined primary.\n*         the last param can be conn.\n* @param: id, [query_cols], cb\n*          - query_cols: [col1,col2], the cols will be query.\n*          - cb: function(err, ret:mod) {}\n*/\nqueryByIdSync( id )\n```\n\n### table-queryLockRow\n\n```js\n/**\n* @desc: query by id and lock row for update (use in transaction).\n*         id is Object if table is combined primary.\n*         the last param can be conn.\n* @param: id, [query_cols]\n*           query_cols: [col1,col2], the cols will be query.\n* @return: mod.\n*/\n*queryLockRow( id )\n/**\n* @desc: query by id and lock row for update (use in transaction).\n*         id is Object if table is combined primary.\n*         the last param can be conn.\n* @param: id, [query_cols], cb\n*           - query_cols: [col1,col2], the cols will be query.\n*           - cb: function(err, ret:mod)  {}\n* @return: mod.\n*/\nqueryLockRowSync( id )\n```\n\n### table-queryTop\n\n```js\n/**\n* @desc: query top.\n*         the last param can be conn.\n* @param: where, {orderby}, [query_cols]\n*           orderby: {key:true/false} true-means asc, false-means desc.\n*           query_cols: [col1,col2], the cols will be query.\n* @return: mod.\n*/\n*queryTop( where )\n/**\n* @desc: query top.\n*         the last param can be conn.\n* @param: where, {orderby}, [query_cols], cb\n*           - orderby: {key:true/false} true-means asc, false-means desc.\n*           - query_cols: [col1,col2], the cols will be query.\n*           - cb: function(err, ret:mod)  {}\n*/\nqueryTopSync( where )\n```\n\n### table-queryWhere\n\n```js\n/**\n* @desc: query\n*         the last param can be conn.\n* @param: where, [offset,limit], {orderby}, [query_cols]\n*           - orderby: {key:true/false} true means asc, false means desc.\n*           - query_cols: [col1,col2], the cols will be query. e.g. ['id', 'name']\n* @return: [mod,mod,...].\n*/\n*queryWhere( where )\n/**\n* @desc: query\n*         the last param can be conn.\n* @param: where, [offset,limit], {orderby}, [query_cols]\n*           - orderby: {key:true/false} true means asc, false means desc.\n*           - query_cols: [col1,col2], the cols will be query. e.g. ['id', 'name']\n*           -cb:  function(err, ret:Array)  {}\n*/\nqueryWhereSync( where )\n```\n\n### table-get_conn\n```js\n/**\n* @desc: 获得最后一个参数,如果为 database_connection则返回.否则返回null.\n* @return:\n*/\nget_conn(arguments)\n```\n\n### table-escape\n\n```js\n/**\n* @desc: escape\n* @return: str.\n*/\nescape( v )\n```\n\n### table-make_condition\n\n```js\n/**\n* @desc: 构造一个 key=value的sql条件语句.\n* @return: sql;\n*/\nmake_condition( key, value )\n```\n\n### table-make_condition_not_equal\n\n```js\n/**\n* @desc: 构造一个 key\u003c\u003evalue的sql条件语句.\n* @return: sql;\n*/\nmake_condition_not_equal( key, value )\n```\n\n### table-make_condition_more\n\n```js\n/**\n* @desc: 构造一个 key\u003evalue的sql条件语句.\n* @return: sql;\n*/\nmake_condition_more( key, value )\n```\n\n### table-make_condition_more_equal\n\n```js\n/**\n* @desc: 构造一个 key\u003e=value的sql条件语句.\n* @return: sql;\n*/\nmake_condition_more_equal( key, value )\n```\n\n### table-make_condition_less_equal\n\n```js\n/**\n* @desc: 构造一个 key\u003c=value的sql条件语句.\n* @return: sql;\n*/\nmake_condition_less_equal( key, value )\n```\n\n### table-make_condition_less\n\n```js\n/**\n* @desc: 构造一个 key\u003cvalue的sql条件语句.\n* @return: sql;\n*/\nmake_condition_less( key, value )\n```\n\n### table-make_condition_like\n\n```js\n/**\n* @desc: 构造一个 key LIKE value的sql条件语句.\n* @return: sql;\n*/\nmake_condition_like( key, value )\n```\n\n### table-make_update_inc\n\n```js\n/**\n* @desc: 用于表示update时字段自增n.\n*/\nmake_update_inc( n );\n// 例如对value字段自增1:\nyield table.update({ ID:1, value: table.make_update_inc(1) });\n```\n\n### table-make_origin_sql\n\n```js\n/**\n* @desc: 用于表明使用原始v, 不做安全检验.\n*/\nmake_origin_sql( v )\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrainpoint%2Ffebs-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrainpoint%2Ffebs-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrainpoint%2Ffebs-db/lists"}