README
nodenamo-shell
An interactive shell interface to Nodenamo
Nodenamo Query Language
Table of Content
- IMPORT
- INSERT
- GET
- LIST
- FIND
- UPDATE
- ON
- DELETE
- UNLOAD TABLE
- CREATE TABLE
- DELETE TABLE
- SHOW TABLES
- EXPLAIN
- DESCRIBE
IMPORT statement
Syntax
IMPORT class FROM "path" IMPORT class AS alias FROM "path" IMPORT {class} FROM "path" IMPORT {class as alias} FROM "path"
where:
classis the exported class decorated with nodenamo's@DBTablealiasis an alias to be referenced to the imported class from subsequent statements.pathis the path to the file or a package containing theclassto import.
Example
IMPORT usersTable as users FROM "./usersTable.ts"
INSERT Statement
Syntax
INSERT jsonObject INTO table WHERE expression
Example
INSERT {id:2,title:"some thing",price:21,status:true} INTO books WHERE attribute_not_exists(id)
GET Statement
Syntax
GET id FROM table STRONGLY CONSISTENT
Example
GET 42 FROM users STRONGLY CONSISTENT
LIST Statement
Syntax
LIST projections FROM table USING indexName BY hashRange FILTER filterExpressions RESUME "lastEvaluatedKey" ORDER order LIMIT number STRONGLY CONSISTENT
where:
projectionsis a list of properties to return. Use*to return all properties.indexNameis the name of a GSI.hashRangeis a value to search against a hash property. It can be optionally followed by a comma and a value to search against a range property.orderisASCorDESCstrongly consistentcan be used to request a consistent read.
Example
LIST * FROM users BY "name" , "timestamp" FILTER email = "someone@example.com" ORDER asc LIMIT 10 STRONGLY CONSISTENT
FIND Statement
Syntax
FIND projections FROM table USING indexName WHERE keyConditions FILTER filterExpressions RESUME "lastEvaluatedKey" ORDER order LIMIT number STRONGLY CONSISTENT
where:
projectionsis a list of properties to return. Use*to return all properties.indexNameis the name of a GSI.orderisASCorDESCstrongly consistentcan be used to request a consistent read.
Example
FIND id, name, email FROM users USING users-gsi WHERE name = "some one" FILTER email = "someone@example.com" resume "token" ORDER desc LIMIT 2 STRONGLY CONSISTENT
UPDATE Statement
Syntax
UPDATE jsonObject FROM table WHERE conditionExpression WITH VERSION CHECK
where:
WITH VERSION CHECKcan be used to request a version check.
Example
UPDATE {id:1,name:"new name"} FROM users WHERE attribute_not_exists(id) WITH VERSION CHECK
ON Statement
Syntax
ON id FROM table SETsetExpression ADD addExpression DELETE deleteExpression REMOVE removeExpression conditionExpression WITH VERSION CHECK
where:
WITH VERSION CHECKcan be used to request a version check.
Example
ON 42 FROM users SET lastViewed = "today" ADD count 1 WHERE published = true WITH VERSION CHECK
DELETE Statement
Syntax
DELETE id FROM table WHERE conditionExpression
Example
DELETE 42 FROM books WHERE deleted <> true
UNLOAD TABLE Statement
Syntax
UNLOAD TABLE name
where:
nameis the imported class name or its alias.
Example
UNLOAD TABLE users
CREATE TABLE Statement
Syntax
CREATE TABLE FOR name WITH CAPACITY OF readCapacityNumber, writeCapacityNumber
where:
nameis the imported class name or its alias.readCapacityNumberis the desired read capacity for the table.writeCapacityNumberis the desired write capacity for the table.
Example
CREATE TABLE FOR users WITH CAPACITY OF 123, 456
DELETE TABLE Statement
Syntax
DELETE TABLE FOR name
where:
nameis the imported class name or its alias.
Example
DELETE TABLE FOR users
SHOW TABLES Statement
Syntax
SHOW TABLES
Example
SHOW TABLES
EXPLAIN Statement
Syntax
Explain statement
where:
statementis one of nodenamo query language stattements.
Example
EXPLAIN INSERT {id:1,name:"some one"} INTO users
DESCRIBE Statement
Syntax
Describe name
where:
nameis the imported class name or its alias.
Example
DESCRIBE users
Output
{
type: 'describe',
name: 'users'
}