-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 6.0.0-alpha-0.0.1 * Release 6.0.0-alpha-0.0.1 : Rewrite without any cache present * some docs * Add some basic copied docs * Shuffle methods so they're in about the same order as existing versions * Tweak docs to explain other things changed * Bit more docs updates and tweaks * Forgot to save md file adding wal/verbose note * Swap filter args so they're the same as find and findkey * Remove todo asking to add something that was already there * fix docs build * 6.0.0-alpha-0.0.2 * put the index/keys/values/entries back to methods rather than getter following user feedback * Add sweep and partition, add more tests * 6.0.0-alpha-0.0.3 * 6.0.0-alpha-0.0.4 * Resolve import that I can blame on typescript * 6.0.0-alpha-0.0.5 * Add error handling for parsing * 6.0.0-alpha-0.0.6 * Make map() and filter() use aggregate methods with the key available * 6.0.0-alpha-0.0.7 * Add more proper docs building, temporary manual uppload for now * 6.0.0 * Remove docs build from CI ffor now
- Loading branch information
1 parent
b982ca9
commit a3246c7
Showing
43 changed files
with
3,216 additions
and
2,365 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,4 @@ jobs: | |
run: npm install | ||
- name: Run Tests | ||
run: npm run test | ||
- name: Build docs | ||
run: npm run docs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,5 @@ out/ | |
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
!.yarn/versions | ||
.retype/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
description: >- | ||
Enmap, the super simple database wrapper with over a million downloads to | ||
date. Wrapping around better-sqlite3 with its warm embrace, it's the easiest | ||
way to save data in node for your first project! | ||
--- | ||
|
||
# What is Enmap? | ||
|
||
![](assets/enmap-logo.svg) | ||
|
||
Enmap stands for "Enhanced Map", and is a data structure based on the native JavaScript Map() structure with additional helper methods from the native Array() structure. Enmap also offers _persistence_, which means it will automatically save everything to save to it in a database, in the background, without any additional code or delays. | ||
|
||
{% hint style="danger" %} | ||
Enmap requires filesystem access. It **DOES NOT WORK** on Heroku, or other such systems that do not allow you to save data directly to disk. | ||
|
||
It should also not be used on **Repl.it** where the data cannot be hidden (and will be public) or on **Glitch* *which has been known to break Enmap's data persistence and lose data. | ||
{% endhint %} | ||
|
||
## Why Enmap? | ||
|
||
While there are other better-known systems that offer some features of Enmap, especially caching in memory, Enmap is targeted specifically to newer users of JavaScript that might not want to deal with complicated systems or database queries. | ||
|
||
## Advantage/Disadvantage | ||
|
||
Here are some advantages of using Enmap: | ||
|
||
* **Simple to Install**: Enmap itself only requires a simple `npm install` command to install and use, and a single line to initialize. [See Installation for details](install/). | ||
* **Simple to Use**: Basic Enmap usage can be completely done with 1-2 lines of initialization, and 3 commands, set(), get() and delete(). | ||
* **Very Fast**: Since Enmap resides in memory, accessing its data is blazing fast (as fast as Map() is). Even with persistence, Enmap still accesses data from memory so you get it almost instantly. | ||
|
||
Some disadvantages, compared to using a database connection directly: | ||
|
||
* **More memory use**: Since Enmap resides in memory and (by default) all its data is loaded when it starts, your entire data resides in RAM. When using a large amount of data on a low-end computer or VPS, this might be an issue for some users. | ||
* **Limited power**: You can have multiple Enmap "tables" loaded in your app, but they do not and cannot have relationships between them. Basically, one Enmap value can't refer to another value in another Enmap. This is something databases can be very good at, but due to the simplistic nature of Enmap, it's not possible here. | ||
* **Lack of scalability**: Enmap is great for small apps that require a simple key/value storage. However, a scalable app spread over multiple processes, shards, or clusters, will be severely limited by Enmap as it cannot update itself from the database on change - one process would not be aware of another process' changes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Table of contents | ||
|
||
* [What is Enmap?](README.md) | ||
* [Enmap Installation](install/README.md) | ||
* [Troubleshooting Guide](install/troubleshooting-guide.md) | ||
* [Migrating data from Enmap 3](install/upgrade.md) | ||
* [Upgrading to Enmap 6](install/upgradev6.md) | ||
* [Usage Documentation](usage/README.md) | ||
* [Basic Data Use](usage/basic.md) | ||
* [Understanding Paths](usage/paths.md) | ||
* [Working with Objects](usage/objects.md) | ||
* [Array Methods](usage/arrays.md) | ||
* [Mathematical Methods](usage/math.md) | ||
* [Using from multiple files](usage/using-from-multiple-files.md) | ||
* [Serializing and Deserializing](usage/serialize.md) | ||
* [Full Documentation](api.md) | ||
* [Blog Posts](blog-posts/README.md) | ||
* [Enmap's History](blog-posts/enmaps-history.md) | ||
* [V4: Why SQLITE only?](blog-posts/why-sqlite-only.md) | ||
* [V6: Why remove cache?](blog-posts/why-remove-cache.md) | ||
* [Enmap and Josh](blog-posts/josh.md) | ||
<!-- * [Supporters and Partners](sponsors.md) --> |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Blog Posts | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Enmap's History | ||
|
||
From the first moment where I started using the Discord.js library, one thing in it fascinated me: "Collections". Discord.js Collections are a Map structure from JavaScript on top of which a bunch of useful methods are added, most notably those from JavaScript's Array structure. | ||
|
||
Things like map, filter, reduce, find, sort... they made Maps so useful, so much more powerful, that I admired their design. It struck me at one point, that if such a structure were to be separated from Discord.js and perhaps made to be saved in a database, it would make interacting with data so easy that even a child could do it. | ||
|
||
So when I started getting seriously into bot that required their own data to be saved, I turned to Amish Shah \(Hydrabolt\) and I said to him, I said "Listen, buddy, can I extract Collections and publish them as a separate module? That'd be awesome!" and Amish replied, like the great guy he is, "uhhhh sure, why not?" | ||
|
||
And so, in May 2017, the `djs-collection` module was born. It was a simple thing, just straight-up lifted from Discord.js' code \(not illegally, mind you, I retained all proper licenses and credits to Hydrabolt!\). The following month, I added persistence \(saving to a database\) to it and published `djs-collection-persistent` , which then became my own defacto way to save data to a database. | ||
|
||
But... let's be honest, `npm install --save djs-collection-persistent` is a mouthful to type out. Plus, I was realizing that having those two as separate modules meant I had to update them separately and ensure they still worked individually... So at one point, I decided it was time to merge them. | ||
|
||
Releasing a single repository meant that I could now change the name, because of the aformentioned "omg mile-long name" problem, and just the overall annoyance of writing it. So I settled on "well, they're enhanced maps, let's call it Enmap!". A quick search revealed Enmap's only other apparent meaning was that it was the name of a satellite, and I was guessing no one would confuse the two. | ||
|
||
But I didn't want to _force_ enmap users to have persistence, so at the same time I actually created a _separate_ module called `enmap-level`, which controlled the database layer and was completely optional. These modules I called _Providers_ since, obviously, they provided data persistence and and API. | ||
|
||
Enmap 0.4.0 was released at the beginning of October 2017, and since then has grown into a fairly solid module used by tens of thousands of people across the world, not only in discord.js bots but also in other projects built with Node. Its solidity and simplicity makes it the ideal storage for simple key/value pairs, and I'm extremely proud to have made it. | ||
|
||
At the moment of writing this \(2018-09-02\) Enmap has been downloaded over 32,000 times and is growing by the minute with almost 10,000 downloads in August alone! | ||
|
||
## Update, August 2019 | ||
|
||
It's been a year now since I last wrote this post. And in case you were wondering, growth hasn't stopped! In fact, it's quite accelerated. One big change that I made was to go back to a single locked-in database provider, which I describe in Why SQLite Only? | ||
|
||
Other than that, and adding some new features due to the switch to better-sqlite3, the main event is that just las month I reached a whopping 500,000 downloads for Enmap. Yes, that's a half million downloads for my little useful module that I started making for myself and ended up being useful for so many. | ||
|
Oops, something went wrong.