Skip to content
New issue

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

new command line of create database , add collection and list collection #297

Merged
merged 10 commits into from
Feb 1, 2023

Conversation

imotai
Copy link
Contributor

@imotai imotai commented Jan 30, 2023

DB3 Cli

./target/debug/db3 console

generate a key for db3 client

db3>- init
Init key successfully!

show key information

db3>- show-key
 address                                    | scheme 
--------------------------------------------+-----------
 0x96bdb8e20fbd831fcb37dde9f81930a82ab5436b | secp256k1 

create a new database

db3>-$ new-db

output

 database address                           | transaction id 
--------------------------------------------+----------------------------------------------
 0xa9f5c8170aad7a0f924d89c6edacae6db24ef57d | 0ALy/hH7CQe9lv294K6dOxGP14xWHsbRs+/pXBZa8oU=

show a database

db3>-$ show-db --addr 0x7e16cb6524e2fc21ae9bf2d7ee18b05767b9dc33

output

 database address                           | sender address                             | releated transactions                        | collections 
--------------------------------------------+--------------------------------------------+----------------------------------------------+-------------
 0x7e16cb6524e2fc21ae9bf2d7ee18b05767b9dc33 | 0x96bdb8e20fbd831fcb37dde9f81930a82ab5436b | EMYw64xlI2q4v1MShoKw3T60asNbWJ9//ca75M3JO3Q= |  

create a collection

db3>$ new-collection --addr 0xcfb524677673af15edebbec018b16d42d87b1251 --name books --index '{"name":"idx1","fields":[{"field_path":"test1","value_mode":{"Order":1}}]}'

output

send add collection done with tx
3V7r7VRg+9zUXeGNmqRR0YdVXWtBSl4sk+Z50h9BrOc=

list all collections in database

db3>-$ show-collection --addr 0xcfb524677673af15edebbec018b16d42d87b1251

output

 name  | index 
-------+----------------------------------------------------------------------------
 books | {"name":"idx1","fields":[{"field_path":"test1","value_mode":{"Order":1}}]}

the updates of mutation

enum DatabaseAction {
    CreateDB = 0;
    AddCollection = 1;
}

message DatabaseMutation {
    db3_base_proto.BroadcastMeta meta = 1;
    repeated CollectionMutation collection_mutations = 2;
    bytes db_address = 3;
    DatabaseAction action = 4;
}

message CollectionMutation {
    repeated db3_database_proto.Index index = 1;
    string collection_id = 2;
}

@imotai imotai changed the title create database create database and add collection Jan 30, 2023
@db3fans db3fans added the S-kv label Jan 30, 2023
@imotai imotai changed the title create database and add collection create database , add collection and list collection Jan 31, 2023
@db3fans
Copy link
Collaborator

db3fans commented Feb 1, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@imotai imotai changed the title create database , add collection and list collection new command line of create database , add collection and list collection Feb 1, 2023
}

#[tokio::test]
async fn cmd_smoke_test() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move cmd smoke test to command.rs?

@db3fans
Copy link
Collaborator

db3fans commented Feb 1, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@db3fans
Copy link
Collaborator

db3fans commented Feb 1, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@db3fans db3fans added the documentation Improvements or additions to documentation label Feb 1, 2023
@db3fans
Copy link
Collaborator

db3fans commented Feb 1, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@db3fans
Copy link
Collaborator

db3fans commented Feb 1, 2023

This PR exceeds the recommended size of 1200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@imotai imotai merged commit de5711f into main Feb 1, 2023
@imotai imotai deleted the feat/create_db branch February 14, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation S-kv size/xl
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants