Coder Social home page Coder Social logo

palmik / data-store Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 3.0 132 KB

Multi-key multi-value store for Haskell native data types with type safe interface.

Home Page: http://hackage.haskell.org/package/data-store

License: BSD 3-Clause "New" or "Revised" License

Shell 1.55% Haskell 98.45%

data-store's People

Contributors

palmik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

data-store's Issues

API documentation update

Hi,
data-store seems a very interesting library for databases, but could you improve the documentation?
Explain, for example, what is the role of tag in

data Store tag krs irs ts v

it seems that there is a mistake with the later example

...
type ContentStore = Store ContentStoreKRS ContentStoreIRS ContentStoreTS Content

Also, it is not clear how the O and M specifications affect the operations that I can run on a Store.

Thanks

Ordered lookups.

Add ordered lookups. The function signatures should look like this (here I assume that (tag, n) denotes dimension of type one-to-one, but it could be extended to one-to-many dimensions as well):

lookupOrderByA :: IsSelection sel => sel tag krs irs ts -> (tag, n) -> I.Store tag krs irs ts v -> [(I.RawKey krs ts, v)]
lookupOrderByD :: IsSelection sel => sel tag krs irs ts -> (tag, n) -> I.Store tag krs irs ts v -> [(I.RawKey krs ts, v)]
lookupMap :: IsSelection sel => sel tag krs irs ts -> (tag, n) -> I.Store tag krs irs ts v -> Data.Map.Map (DimensionType krs irs n) (I.RawKey krs ts, v)

MySQL implements this (in the most general case) by sorting the result of the query afterwards [1]. I know we can do better at least in the case where the selection is simply (SelectionDimension n) and we want to order the results by (tag, n).

Data.Store.map fails to update index.

I haven't yet produced a minimal test case as my application is fairly complex, but here's the gist:

I'm using Storable to create a table for a record I have. The record has a field watchWState that is essentially defined as Active Int | Notifying.

If I do a map to update the state to Notifying from Active, if I do a query like S.lookup (sWatchWState .== Notifying) table, it comes back with nothing. Showing the raw table shows that the value of the row has Notifying, but the key portion still has the original value.

I can't imagine this is expected behavior. Maps by definition will update the records, so its weird that you cannot query the new table by the new values. It seems like the code https://github.com/Palmik/data-store/blob/master/src/Data/Store.hs#L445 just passes the key straight through.

In the mean time i guess I can do something like (S.fromList . Data.List.map . S.toList).

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.