SQL查询构建器 knex.js

码农软件 · 软件分类 · ORM/持久层框架 · 2019-09-23 14:57:25
  • 授权协议: MIT
  • 开发语言: JavaScript
  • 操作系统: 跨平台
  • 软件首页: http://knexjs.org

软件介绍

knex.js 是一个查询构建器,用于 PostgreSQL, MySQL 和 SQLite3。它设计灵活,轻便和有趣。

特性:

例子:

var knex = require('knex')({
  dialect: 'sqlite3',
  connection: {
    filename: './data.db'
  }
});
// Create a table
knex.schema.createTable('users', function(table) {
  table.increments('id');
  table.string('user_name');
})
// ...and another
.createTable('accounts', function(table) {
  table.increments('id');
  table.string('account_name');
  table.integer('user_id').unsigned().references('users.id');
})
// Then query the table...
.then(function() {
  return knex.insert({user_name: 'Tim'}).into('users');
})
// ...and using the insert id, insert into the other table.
.then(function(rows) {
  return knex.table('accounts').insert({account_name: 'knex', user_id: rows[0]});
})
// Query both of the rows.
.then(function() {
  return knex('users')
    .join('accounts', 'users.id', 'accounts.user_id')
    .select('users.user_name as user', 'accounts.account_name as account');
})
// .map over the results
.map(function(row) {
  console.log(row);
})
// Finally, add a .catch handler for the promise chain
.catch(function(e) {
  console.error(e);
});

本文地址:https://codercto.com/soft/d/15232.html

快速转行做产品经理

快速转行做产品经理

李三科 / 华中科技大学出版社 / 2018-6-1 / 39.90

互联网已经进入以产品为中心的时代,不懂技术一样做高薪产品经理。本书将满足你转行、就业、加薪的愿望。 . 作者李三科,互联网资深产品经理。2011年离开传统销售行业进入互联网行业工作,从对产品经理的工作一无所知,到成长为一名年薪几十万的资深产品经理,他对产品经理职业有着深刻的理解,也积累了丰富的学习、工作经验。本书以作者亲身经历为线索,讲解学习产品经理相关知识和工作方法的经验,同时介绍求......一起来看看 《快速转行做产品经理》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

随机密码生成器
随机密码生成器

多种字符组合密码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具