GithubHelp home page GithubHelp logo

Hash support about fsql HOT 9 CLOSED

kashav avatar kashav commented on June 14, 2024
Hash support

from fsql.

Comments (9)

 avatar commented on June 14, 2024

@kshvmdn This doesn't look too bad to get in, I haven't looked to much at the parsing logic but should be able to follow the logic for the other key words. Anything other than SHA-1 We'd like to see?

from fsql.

kashav avatar kashav commented on June 14, 2024

@jonesbrianc26 Sounds good!

Let's do this by introducing a new attribute, hash. I think the best way to specify which algorithm to use is with an attribute modifier, so perhaps

SELECT SHA1(hash) ...
... WHERE SHA256(hash) = ...

or

SELECT FORMAT(hash, SHA1) ...
... WHERE FORMAT(hash, SHA256) = ...

For the time being, lets stick with SHA-1 and see how that goes (crypto/sha1 will probably be useful for this). We should be able to easily abstract this to support multiple different algorithms in the future.

from fsql.

 avatar commented on June 14, 2024

Turns out this isn't too bad, Though will probably need to rethink the output function a little bit to be smarter with spacing. I'll play around with it a little bit @kshvmdn what do you think?

from fsql.

kashav avatar kashav commented on June 14, 2024

Awesome!

The original output format was meant to match that of ls -l, I think we can stick with that?

[mode] [size] [time] [hash] [name]

Also, I think by default, we should show a truncated version of the hash (maybe 7-10 characters, like Git), and we can include a FULL function to show the full hash (perhaps even a TRUNCATE(, n) function to specify how many characters to show?). Feel free to leave it at the full hash for now though, we can add these functions later (or go ahead and implement it, up to you! 😄).

from fsql.

 avatar commented on June 14, 2024

perhaps just {hashtype}(hash, n) though, TRUNCATE(,n) could be useful in general and would be a extremely reusable function so it would make sense to use that under the hood.

from fsql.

kashav avatar kashav commented on June 14, 2024

You're right, that works better!

If n isn't provided, let's default it to 7 for the time being, just so the output of all doesn't overflow.

from fsql.

 avatar commented on June 14, 2024

Also, as far as formatting goes, what would you like to display in place of the hash for directories?

Currently I'm displaying 1 - for every character in the hash to preserve equal spacing, maybe once I get the PR up we can discuss that a bit more.

from fsql.

kashav avatar kashav commented on June 14, 2024

Sounds good to me!

from fsql.

kashav avatar kashav commented on June 14, 2024

Done in #31 – currently only supports SHA-1, feel free to suggest other functions.

from fsql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.