Effective Update #10
realfakenerd
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks! currently, I am rewriting the database codebase and changing the design a bit, shifting the focus from a very fast database to a very reliable one. I hope that's a good move. With this change, I am moving from zero dependencies to one (I know
devalue
was already there, but this is a more significant one).I learned about
Effect.ts
from this video by Matt Pocock.Effect works wonders. It has a bit of a learning curve, but it has great documentation and is made with TypeScript, making it a really great dependency.
It calls itself "the missing standard library for TypeScript," and it really feels like that, filling some gaps that JS and TS currently have. It will help me make the database more composable, like Lego bricks.
It already has most of the features I need. Jason will have better error handling, making it more reliable. It will be easier to catch bugs and faster to introduce new features (I have some plans for it). I'm also learning a lot while writing the new codebase.
As an example, the new API will look like this:
The schema is inferred, so there's no need to pass an interface beforehand. Also, taking inspiration from Dexie.js, you can do this:
It will properly transform the string into a schema. But if you noticed, everything is a string. That's the default behavior I chose, but what if you want to have an age or a boolean value?
Why do this? Why not just use the
Schema
? Well, this way you don't need to installEffect
as a dependency for your project. You certainly can if you want to, but it's not required. If you do install it, you can use the full power of Effect with the DB Layer:So, that's it for this update. If you want to check out what I'm doing, it's on the
refactor/add-effect-ts
branch here: refactor branch.Do you have any ideas, opinions, or critiques? Just let me know
Update 1:
Currently, i am working on making metadata useful, and indexes.
Update 2:
Metadata is almost ready, same for indexes with BTree. Working on improving the Config Service and improving the Types for better inference.
Beta Was this translation helpful? Give feedback.
All reactions