# Entity Module Commands

# Get Entity Table

# Usage

Usage: miyabi-cli getentitytable [Options]

Options:
--help             Show help information
-t|--table <name>  Entity table name

# Functionality

Online general reference command that returns the contents of an entity table specified by -t. -t is required.

# Example

$ ./miyabi-cli.exe getentitytable -t test_entity
{"1111":{"data":"foo","parents":[],"children":{"relation":[{"tableName":"test_entity_child","entryId":"2222"}]}}

# Get Entity

# Usage

Usage: miyabi-cli getentity [Options]

Options:
--help             Show help information
-t|--table <name>  Entity table name
-k|--key <hex>     Key of the entry

# Functionality

Online general reference command that returns the specific entity table entry specified by -t and -k. -t and -k are required.

# Example

$ ./miyabi-cli.exe getentity -t test_entity -k 111
{"data":"foo","parents":[],"children":{"relation":[{"tableName":"test_entity_child","entryId":"2222"}]}}

# Get Entity Tree

# Usage

Usage: miyabi-cli getentitytree [Options]

Options:
--help             Show help information
-t|--table <name>  Entity table name
-k|--key <hex>     Key of the entry
--depth <num>      Maximum depth of the tree

# Functionality

Online general reference command that returns the entity tree where the root is the entry specified by -t and -k. --depth has a default value 1000, represent the depth of the given tree.

# Example

$ ./miyabi-cli.exe getentitytree -t test_entity -k 1111
{"data":"foo","isRecursive":false,"children":{"relation":[{"data":"bar","isRecursive":false,"children":{}}]}}

# Create Entity Table

# Usage

Usage: miyabi-cli sendtransaction createentitytable [Options] [-- InnerCommand [InnerCommand Options] <arg(s)>]

Options:
--help                 Show help information
-o|--owner <address>   Table owner's address
-r|--restricted        Read restricted
-p|--privatekey <key>  Private key of table admin
-t|--table <name>      Table name
--proofs               Turn on proof
--track                Track the history
-r|--restricted        Read restricted
--can-insert <address> Addresses which have table level insert permission
--can-update <address> Addresses which have table level update permission
--can-read <address>   Addresses which can read entries from the table

# Functionality

Transaction subcommand that will create an entity table where the table owner has all ACL permission. -o, -t, and -p are required.

# Example

$ ./miyabi-cli.exe sendtransaction createentitytable -t test_entity -o 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 -p 10425b7e6ebf5e0d5918717f77ce8a66aaf92bc64b65996f885ff12bd94ef529
8da48ee28bdde175d18b9bf9086865f275104f00c0e1f4b5738ed73994e2d46a

# Add Entity

# Usage

Usage: miyabi-cli sendtransaction addentity [Options] [-- InnerCommand [InnerCommand Options] <arg(s)>]

Options:
--help                 Show help information
-p|--privatekey <key>  Private key of table owner
-t|--table <name>      Entity table name
-k|--key <hex>         Key of the entity
-v|--value <string>    Value of the entity
-o|--owner <address>   Owner address to this entity
--parent <parent>      Reference to a parent "table_name key tag"

# Functionality

Transaction subcommand that will add an entity entry to the given table. -o represent the owner of the entry and --parent allows specify one parent of the entity in an entity table(supports different table). -p should be insert admin. -p, -t, -k and -v are required.

# Example

$ ./miyabi-cli.exe sendtransaction addentity -p 01 -t test_entity -k 1111 -v foo --parent "test_entity 1112 child"
9c7b1cfbe34b71a1ed90a1100baa000185223787bba04b6054f38ee12c47b5a7

# Update Entity

# Usage

Usage: miyabi-cli sendtransaction updateentity [Options] [-- InnerCommand [InnerCommand Options] <arg(s)>]

Options:
--help                 Show help information
-p|--privatekey <key>  Private key of entity owner(or entity table owner)
-t|--table <name>      Entity table name
-k|--key <hex>         Key of the entity
-v|--value <string>    Value of the entity

# Functionality

Transaction subcommand that will update the value of entity entry specified by -t and -k to -v. -p should include either update admin or row owner. -p, -t,-k, and -v are required.

# Example

$ ./miyabi-cli.exe sendtransaction updateentity -p 01 -t test_entity -k 1111 -v bar
4455bc2efb489c1532abf0d9032b5771329b90bf0b23db825c0af930eeea8ab6

# Add Entity Parent

# Usage

Usage: miyabi-cli sendtransaction addentityparent [Options] [-- InnerCommand [InnerCommand Options] <arg(s)>]

Options:
--help                 Show help information
-p|--privatekey <key>  Private key of entity owner(or entity table owner)
-t|--table <name>      Entity table name
-k|--key <hex>         Key of the entity
--parent <parent>      Reference to a parent "table_name key tag"

# Functionality

Transaction subcommand that adds an entity parent to specify entity entry. -t, -k,--parent, and -p is required.

# Example

$ ./miyabi-cli.exe sendtransaction updateentity -p 01 -t test_entity_child -k 2222 --parent "test_entity 1111 tag_name"
dfd6ee94efc3631d9d09ba7e91cda6a1a4c855529807b883a07fa9520d53afa4

# Delete Entity

# Usage

Usage: miyabi-cli sendtransaction deleteentity [Options] [-- InnerCommand [InnerCommand Options] <arg(s)>]

Options:
--help                 Show help information
-p|--privatekey <key>  Private key of entity owner(or entity table owner)
-t|--table <name>      Entity table name
-k|--key <hex>         Key of the entity

# Functionality

Transaction subcommand that deletes the entity entry. All options except --help are required.

# Example

$ ./miyabi-cli.exe sendtransaction deleteentity -p 01 -t test_entity -k 1111
83261a18bd6f245a3c6f8cacad3976d43734883724a019f227fbaf7e0e46f507

# Delete Entity Parent

# Usage

Usage: miyabi-cli sendtransaction deleteentityparent [Options] [-- InnerCommand [InnerCommand Options] <arg(s)>]

Options:
--help                 Show help information
-p|--privatekey <key>  Private key of entity owner(or entity table owner)
-t|--table <name>      Entity table name
-k|--key <hex>         Key of the entity
--parent <parent>      Reference to a parent "table_name key tag"

# Functionality

Transaction subcommand that will delete a parent reference from the entity entry. All options except --help are required.

# Example

$ ./miyabi-cli.exe sendtransaction deleteentityparent -p 01 -t test_entity_child -k 2222 --parent "test_entity 1111 tag_name"
00512e273727dbd414c507f20ce9693e11b2111f7a474edb90c737b6331f22e7

# Optimistic Update Entity

# Usage

Usage: miyabi-cli sendtransaction optimisticupdateentity [Options] [-- InnerCommand [InnerCommand Options] <arg(s)>]

Options:
--help                          Show help information
-p|--privatekey <key>           Private key of entity owner(or entity table owner)
-t|--table <name>               Entity table name
-k|--key <hex>                  Key of the entity
-v <string>|--value <string>    New value of the entity
-c <string>|--current <string>  Current value of the entity

# Functionality

Transaction subcommand that compares an entity with its current value c and if it matches, updates it with the new value v. All options except --help are required.

# Example

$ ./miyabi-cli.exe sendtransaction optimisticupdateentity -p 01 -t test_entity_child -k 2222 -v "3333" -c "1111"
00512e273727dbd414c507f20ce9693e11b2111f7a474edb90c737b6331f22e7