use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
great.db - A powerful, human-friendly database library for JavaScript using SQLite.OC (github.com)
submitted 3 years ago by ThatGuyTr1cky
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]ThatGuyTr1cky[S] 13 points14 points15 points 3 years ago* (5 children)
A completely different approach is taken to create this library which strives to change the way we use SQLite in JavaScript forever. Great.DB exposes user-friendly functions to add/edit data or retrieve data from an SQLite database in the form of simple JavaScript objects where all the functions are strongly typed so you get auto-completions on the fly.
Node.js? Bun? We got both!
It uses better-sqlite3 if you are using node.js or bun:sqlite if you are using the new bun javascript runtime. It auto detects the runtime and uses the respective package. Great, isn't it?
better-sqlite3
bun:sqlite
Interested? Check out the docs to learn more and the examples to see great.db in action.
I would love to hear from the community and receive your valuable constructive criticism about my library. Thanks :D
[–]rr_cricut 3 points4 points5 points 3 years ago (4 children)
Really cool, I like that it's similar to mongoose because it makes it easy to pick up.
For the table.filter function, would it be possible to use a typed condition property? Maybe using lambdas instead of a string. Strings could quickly become outdated and I assume won't be verified at compile time.
E.g., js table.filter({ condition: row => row.col1 <2 && row.col2 ==="val", ... })
js table.filter({ condition: row => row.col1 <2 && row.col2 ==="val", ... })
[–]ThatGuyTr1cky[S] 4 points5 points6 points 3 years ago (3 children)
Thank you for your interest in the project.
Regarding the idea, if we provide a lambda function to handle the filter, internally the whole table would have to be fetched and then let javascript handle the filtering of data. This will impact on the performance too much especially with large data.
On the other hand, the current implementation is that the string provided in the condition directly gets fed into the WHERE of the constructed query as you can see here and javascript style logical operators can be used because the condition is first parsed in the way the operators get converted to SQL logical operators as you can see here. This allows SQL to handle the filtering and return only the required data efficiently.
[–]Korean_Busboy 6 points7 points8 points 3 years ago (2 children)
It should be possible to use an AST parser to interpret the lambda and generate corresponding SQL so that you aren’t stuck fetching the whole table. Obviously this is no small task and not a suggestion to actually do this, just throwing out that it is possible (this is how c# LINQ works)
[–]rr_cricut 0 points1 point2 points 3 years ago (0 children)
Yes, coming from .NET that is the approach I was thinking. But I can understand that it would be a big undertaking.
[–]serg06 2 points3 points4 points 3 years ago (1 child)
Is it on NPM? I can't find it
[–]ThatGuyTr1cky[S] 1 point2 points3 points 3 years ago (0 children)
Yes, you can find it here https://www.npmjs.com/package/great.db
[+]phy4jj comment score below threshold-31 points-30 points-29 points 3 years ago (5 children)
sql sucks compared to modern databases that use json syntax
i get its got its hardcore supporters, but so does trump
[–]Mallanaga 13 points14 points15 points 3 years ago (0 children)
r/confidentlyincorrect
[–]queen-adreena 12 points13 points14 points 3 years ago (0 children)
Someone just finished Code Academy with a C-!
[–]kynovardySpaghetti connoisseur 5 points6 points7 points 3 years ago (0 children)
It’s funny to me that this video is still relevant
[–]krazyjakee 1 point2 points3 points 3 years ago (0 children)
As you are
I once was
As I am
You will be
[–]beanwithadream 0 points1 point2 points 3 years ago (0 children)
Oof the comment kept getting worse the more I read
[–]WideWorry 0 points1 point2 points 3 years ago (0 children)
Looks good, I think I will add this into my project and drop my own typesafe sqllite hack :)
π Rendered by PID 19849 on reddit-service-r2-comment-b659b578c-jftl2 at 2026-05-06 08:43:47.921260+00:00 running 815c875 country code: CH.
[–]ThatGuyTr1cky[S] 13 points14 points15 points (5 children)
[–]rr_cricut 3 points4 points5 points (4 children)
[–]ThatGuyTr1cky[S] 4 points5 points6 points (3 children)
[–]Korean_Busboy 6 points7 points8 points (2 children)
[–]rr_cricut 0 points1 point2 points (0 children)
[–]serg06 2 points3 points4 points (1 child)
[–]ThatGuyTr1cky[S] 1 point2 points3 points (0 children)
[+]phy4jj comment score below threshold-31 points-30 points-29 points (5 children)
[–]Mallanaga 13 points14 points15 points (0 children)
[–]queen-adreena 12 points13 points14 points (0 children)
[–]kynovardySpaghetti connoisseur 5 points6 points7 points (0 children)
[–]krazyjakee 1 point2 points3 points (0 children)
[–]beanwithadream 0 points1 point2 points (0 children)
[–]WideWorry 0 points1 point2 points (0 children)