Ruffle
Installation
npm install ora-ruffle
Example Usage
Importing
const Ruffle = var ruffle =
Creating a table for transactions
let table = "transactions"let schema = id: 'string' from: 'string' to: 'string' amount: 'uint'var transactions = ruffle
Load table for transactions
let table = "transactions"let schema = id: 'string' from: 'string' to: 'string' amount: 'uint'var transactions = ruffle
Put key into db
let key = 'id'let transaction = id: key from: 'address1' to: 'address2' amount: 20000ruffle
The put command returns a proof and value, or an error.
Proof { }
Get item from the table
ruffle
let pred = account: "key"ruffle
Documentation
CRUD Operations
Create
name | type | description |
---|---|---|
table | string | name of the table |
schema | JSON | schema for the table |
This creates a table with name, tableName, and returns a confirmation boolean if correct.
let table = "transactions"let schema = balance: 'uint' account: 'string'var transactions = ruffle
Put
name | type | description |
---|---|---|
tableName | string | name of the table |
key | byte array | key for the value |
value | bytes array | value being placed in the table |
This operation does a put, and returns a proof.
let key = '.....'let value = account: key value: 1000ruffle
Get
name | type | description |
---|---|---|
table | string | name of the table |
key | byte array | key for the value |
Gets a value corresponding to the key, within the tableName.
ruffle
Remove
name | type | description |
---|---|---|
tableName | string | name of the table |
key | byte array | key for the value |
Deletes the value associated with the key at the designated table.
Verification
Filters, Aggregates, Maps, and Groups
Filter
Each filter can be shown as a combination of three variables.
name | type | description |
---|---|---|
name | string | name of the table |
expression | string | key for the predicate type |
value | integer, string, value type | key for the value |
let filter = name: "name" expression: "=" value: "hello"ruffle
Output
Future Work
Future work on this library:
- Schema Validation
- Optimized range queries
- Integrating mapping, and aggregation functions
- Query optimization
- Addition of developer-based authenticated updates