only-cliches / Nano-SQL

Universal database layer for the client, server & mobile devices. It's like Lego for databases.
https://nanosql.io
MIT License
781 stars 49 forks source link

parser.js:193 parseError #183

Open Cariaga opened 5 years ago

Cariaga commented 5 years ago

Current Version "nano-redis": "^1.7.2", "nano-sql": "^1.8.5",

Expecting Error

ReplyError: ERR unknown command 'zscan'

  - parser.js:193 parseError
    [RealTimeServer]/[redis-parser]/lib/parser.js:193:12

  - parser.js:303 parseType
    [RealTimeServer]/[redis-parser]/lib/parser.js:303:14
Code
const nSQL = require("nano-sql").nSQL;
const RedisAdapter = require("nano-redis").RedisAdapter;

nSQL("users") // table name
.model([ // data model
    {key: "id", type: "uuid", props: ["pk"]}, // primary key
    {key: "name", type: "string"},
    {key: "age", type: "int", props: ["idx"]} // secondary index
])
.config({
    mode: new RedisAdapter({ // required
        // identical to config object for https://www.npmjs.com/package/redis
        host: "localhost"
    })
}).connect().then(() => {
    // add record
    return nSQL("users").query("upsert", {name: "Jeb", age: 30}).exec();
})
.catch((error)=>{
  console.log(error);
})

.then(() => {
  //select record
 return nSQL("users").query("select").exec();
})
.catch((error)=>{
  console.log(error);
})
.then((rows) => {
  console.log(rows) // [{id: "1df52039af3d-a5c0-4ca9-89b7-0e89aad5a61e", name: "Jeb", age: 30}]
})
.catch((error)=>{
  console.log(error);
})
.then(() => {
  // delete record
  return nSQL("users").query("delete", {name: "Jeb", age: 30}).exec();
})
.catch((error)=>{
console.log(error);
})
;

My other packages

    "byteof": "^0.1.1",
    "chai": "^4.2.0",
    "chai-as-promised": "^7.1.1",
    "cron-cluster": "^1.1.3",
    "express": "^4.17.1",
    "fast-safe-stringify": "^2.0.7",
    "helmet": "^3.21.1",
    "http": "0.0.0",
    "ioredis": "^4.14.1",
    "multi-loggerjs": "^1.0.0",
    "nano-redis": "^1.7.2",
    "nano-sql": "^1.8.5",
    "needle": "^2.4.0",
    "path": "^0.12.7",
    "pretty-error": "^2.1.1",
    "redis": "2.8.0",
    "socket.io": "^2.3.0",
    "socket.io-monitor": "^2.0.1",
    "socket.io-redis": "^5.2.0",
    "socketio-jwt-auth": "^0.1.0"