We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nSQL().createDatabase({ id: "my-db", mode: "TEMP", // pass in "PERM" to switch to persistent storage mode! tables: [ { name: "users", model: { // pk == primary key, ai == auto incriment, "id:int": {pk: true, ai: true}, "name:string": {}, "age:int":{} } }, { name: "users1", model: { // pk == primary key, ai == auto incriment, "id:int": {pk: true, ai: true}, "name:string": {}, "age:int":{} } }, ] }) .then(function() { // Add a record nSQL("users1").query('upsert',{ name:"aaa", age: 10 }).exec();
return nSQL("users").query('upsert',{ name:"aaa", age: 20 }).exec();
}) .then(function(result) { // select all rows return nSQL() .query('select',["users1.name AS aaa"]) .join({ type:"left", with:{table:"users1"}, on:["users.name","=","users1.name"] }).exec(); }) .then(function(result) { var elem = document.createElement("pre"); document.body.appendChild(elem); elem.innerHTML = JSON.stringify(result, null, 4) })
result: [ { "aaa.0": "a", "aaa.1": "a", "aaa.2": "a" } ]
The text was updated successfully, but these errors were encountered:
Fixed Issue #161
211617b
This has been resolved in 2.3.6
2.3.6
Sorry, something went wrong.
Cherrypick fix for only-cliches#161
7981fc1
And adding dist to sources.
No branches or pull requests
nSQL().createDatabase({
id: "my-db",
mode: "TEMP", // pass in "PERM" to switch to persistent storage mode!
tables: [
{
name: "users",
model: {
// pk == primary key, ai == auto incriment,
"id:int": {pk: true, ai: true},
"name:string": {},
"age:int":{}
}
},
{
name: "users1",
model: {
// pk == primary key, ai == auto incriment,
"id:int": {pk: true, ai: true},
"name:string": {},
"age:int":{}
}
},
]
})
.then(function() {
// Add a record
nSQL("users1").query('upsert',{
name:"aaa", age: 10
}).exec();
})
.then(function(result) {
// select all rows
return nSQL()
.query('select',["users1.name AS aaa"])
.join({
type:"left",
with:{table:"users1"},
on:["users.name","=","users1.name"]
}).exec();
})
.then(function(result) {
var elem = document.createElement("pre");
document.body.appendChild(elem);
elem.innerHTML = JSON.stringify(result, null, 4)
})
result:
[
{
"aaa.0": "a",
"aaa.1": "a",
"aaa.2": "a"
}
]
The text was updated successfully, but these errors were encountered: