Share your code.
[VERY MUCH A WORK IN PROGRESS]
Simple key value implementation on top of old fashioned sql.
Some stuff I like for storing my data
- A very simple engine with a minimal api (get, put, del, query) so it can be replaced with something more optimized if needed
- Old fashion storage engines that you can hire as a service and install locally
- options (sqlite, mysql, postgresql)
- Data model flexibility, no schemas
- Enforce querying on indexes, so they are always fast
- Separating indexes from the actual data, and dynamically generating them on put
- The ability to cheat on all of the above if you need it
- Transactions and aggregates
- No type checking, validation etc.
- Not very space efficient (index is data copy)
- Definitely not the fastest way to store data
models =person:kind: "person"indexes:age: type: "int": dataagedata =key: utilsuuidkind: "person"name: "Koen Bok"age: 29backend = "postgres://localhost/test"store = backendmodelspersonstorecreate# Store a person (upsert)storeput data# Get a person by keystoreget "person"datakeyconsolelog result# Query persons older then 10 yearsstorequery "person""name >": "10"consolelog result
<"dsl"><models>storecreate <"kind">callbackstoreget <"kind"><"key"keys>callbackstoreput <"kind"><datadata>callbackstoredel <"kind"><"key"keys>callbackstorequery <"kind"><filters>callback
REST API example using express. Deployable to Heroku.
- Make it work in the browser with websql database
- Add middleware system and implementations (caching, serializing, performance, logging, structured data validation, authentication)
- Add events action.pre|post
- Refactor transactions to be objects
- Refactor query pattern to something nicer (allowing querying on multiple indexes)