The Easiest Database you could ever need!

August 4, 2022

As a developer, you might have heard of FireBase. But do you know about…..WaterBase ??

I’ve always admired Android in the way of storing persistent data. If you are famaliar with Android Development, you’d know about Shared Preferences. If that’s new to you, it is basically a storage utility that Android provides using which you can store data in Key-value form. Shared Preferences are suitable in different situations. For example, when the user’s settings need to be saved or to store data that can be used in different activities within the app.

But…we don’t get that awesome feature outside the Android environment. Do we? So I decided to create a lightweight storage utility that provides such behavior and can be used on any platform. And voila🎉…WaterBase was born 😉


So first thing’s first. Why the name ?

Ok…so here’s my explanation. As we all know that FireBase is a database that is in cloud and can be accessed from anywhere. And so WaterBase is a database on your hard disk that can be accessed from anywhere…just like water…simple and lightweight🪶.

How it’s used ?

As promised, in the easisest way…
WaterBase is currently available in C++ and Python

Talk is cheap. Show me the code.

Ok then…here’s the Python version

Python usage

And if you rather prefer C++, you’re covered:

C++ usage


First we create an instance of the class WaterBase. We provide the name of the WaterBase database to use as parameter. If no database exists by that name, a new one is created.

Now let’s put some values in our database. WaterBase supports three types of values: Boolean, Integer and String. To save values, use the db.Save*(key, value) function

Save values

Now if you want to retreive these values, use db.Load*(key, default_value) function.

Load values

That’s all…This is the simplest databse you could ever need. You can find the GitHub repository here.

And one last thing…if you’ve read till here and are still unsure whether should you use WaterBase or not in a project, then please, please, please drop a comment, describing why you don’t wanna use it. It can help me to make WaterBase a better product, more suited for all. You may even consider contributing to the GitHub repo
Untill next time

Source link

Comments 0

Leave a Reply

Your email address will not be published. Required fields are marked *