-
Notifications
You must be signed in to change notification settings - Fork 119
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
How to show human readable file sizes? #15
Comments
Great idea! I'm thinking about introducing something called an attribute modifier, essentially used to modify attributes (this'll also be used for #3). I'll create an in-depth issue about this in the coming days. I want the syntax to focus more on the actual attribute, so it doesn't feel like you're using a function. My preliminary thought is to do something like this -- SELECT name::upper, size::mb FROM . WHERE time::iso ... This will also allow attributes to have more than one modifier. Of course attributes can be selected without any modifier as well. The only downside that I see in doing it like this is that we're kind of moving away from SQL syntax (I'm not really sure if this is a problem). Would love to hear your thoughts on this! |
It sounds so cool, as you said attribute modifier breaks SQL syntax, but functions not. I'm using another tool named osquery, it looks like fully matched SQL syntax. |
@applee This is now implemented! You can get a human-readable file size as follows: $ fsql "SELECT name, FORMAT(size, MB) FROM . WHERE ..." |
It would be better to support some function to convert the size unit, e.g. kb/mb/gb. So the sql would be as below
fsql "select name, mb(size) from . where ...."
The text was updated successfully, but these errors were encountered: