-
Notifications
You must be signed in to change notification settings - Fork 116
show attributes of current database #490
base: fluffyemily/cli
Are you sure you want to change the base?
Conversation
* Create tools directory containing new crate for mentat_cli. * Add simple cli with mentat prompt.
* Open named database OR default to in memory database if no name provided Rearrange workspace to allow import of mentat crate in cli crate Create store object inside repl when started for connecting to mentat Use provided DB name to open connection in store Accept DB name as command line arg. Open on CLI start Implement '.open' command to open desired DB from inside CLI * Implement Close command to close current DB. * Closes existing open db and opens new in memory db * Review comment: Use `combine` to parse arguments. Move over to using Result rather than enums with err * Accept and parse EDN Query and Transact commands (#453) (#465) * Parse query and transact commands * Implement is_complete for transactions and queries * Improve query parser. Am still not happy with it though. There must be some way that I can retain the eof() after the `then` that means I don't have to move the skip on spaces and eof Make in process command storing clearer. Add comments around in process commands. Add alternative commands for transact/t and query/q * Address review comments r=nalexander. * Bump rust version number. * Use `bail` when throwing errors. * Improve edn parser. * Remove references to unused `more` flag. * Improve naming of query and transact commands. * Send queries and transactions to mentat and output the results (#466) * Send queries and transactions to mentat and output the results move outputting query and transaction results out of store and into repl * Add query and transact commands to help * Execute queries and transacts passed in at startup * Address review comments =nalexander. * Bump rust version number. * Use `bail` when throwing errors. * Improve edn parser. * Remove references to unused `more` flag. * Improve naming of query and transact commands. * Execute command line args in order * Addressing rebase issues
* Implement exit command for cli tool * Address review comments r=rnewman * Include exit commands in help
| edn::Value::Vector((&schema.schema_map).iter() | ||
| .filter_map(|(entid, attribute)| { | ||
| if let Some(ident) = schema.get_ident(*entid) { | ||
| if !ident.namespace.starts_with("db") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want an is_builtin predicate instead of doing this.
A more thorough approach is to check whether the entid of the ident is in the db part or the user part, no?
| return Some(attribute.to_edn_value(Some(ident.clone()))); | ||
| } | ||
| } | ||
| return None; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Equivalent to just
None
|
|
||
| edn::Value::Vector((&schema.schema_map).iter() | ||
| .filter_map(|(entid, attribute)| { | ||
| if let Some(ident) = schema.get_ident(*entid) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One advantage of match:
match schema.get_ident(*entid) {
Some(ident) if ident.is_builtin() => {
Some(attribute.to_edn_value(Some(ident.clone())))
},
_ => None,
}
c08a14d to
2b6398b
Compare
|
@fluffyemily is there anything to salvage from this PR? |
|
It would be great to have an edn dump of the current schema available in the android API. I am happy to try and make a PR for that. I guess that you have some code to convert the output of current_schema to edn in the PR? |
|
@sc13-bioinf: |
|
Is there a way to convert that into something similar to the contents of cities.edn? Keyword(Keyword(NamespaceableName { namespace: Some("db"), name: "ident" })): Keyword(Keyword(NamespaceableName { namespace: Some("community"), name: "name" })) |
|
@sc13-bioinf you can use |
|
I had a go at adding this to the Android bindings. Not sure how correct / safe this is as I am new to rust + JNA. master...sc13-bioinf:android-current-schema If you approve then I can submit a PR or make some changes. |
|
@sc13-bioinf you should submit a PR, rather than trying to have folks discuss it here. Thanks! |
#459