@aviv-s/express.db
v0.1.0
Published
ExpressDB is a lightweight and flexible database module for Node.js, designed to provide easy data storage and retrieval capabilities. It offers a simple and intuitive API similar to Quick.db, making it effortless to integrate into your projects.
Downloads
1
Readme
��#� �I�n�s�t�r�o�d�u�c�t�i�o�n�
�
�E�x�p�r�e�s�s�D�B� �i�s� �a� �l�i�g�h�t�w�e�i�g�h�t� �a�n�d� �f�l�e�x�i�b�l�e� �d�a�t�a�b�a�s�e� �m�o�d�u�l�e� �f�o�r� �N�o�d�e�.�j�s�,� �d�e�s�i�g�n�e�d� �t�o� �p�r�o�v�i�d�e� �e�a�s�y� �d�a�t�a� �s�t�o�r�a�g�e� �a�n�d� �r�e�t�r�i�e�v�a�l� �c�a�p�a�b�i�l�i�t�i�e�s�.� �I�t� �o�f�f�e�r�s� �a� �s�i�m�p�l�e� �a�n�d� �i�n�t�u�i�t�i�v�e� �A�P�I� �s�i�m�i�l�a�r� �t�o� �Q�u�i�c�k�.�d�b�,� �m�a�k�i�n�g� �i�t� �e�f�f�o�r�t�l�e�s�s� �t�o� �i�n�t�e�g�r�a�t�e� �i�n�t�o� �y�o�u�r� �p�r�o�j�e�c�t�s�.�
�
�
�
�#� �I�n�s�t�a�l�l�a�t�i�o�n�
�
��
��n�p�m� �i� �@�a�v�i�v�-�s�/�e�x�p�r�e�s�s�.�d�b�
��
�
�
�
�
�#� �U�s�a�g�e�
�
�-�-�-�
�
�#�#� �S�e�t�
�
�-� ��a�w�a�i�t� �d�b�.�s�e�t�(�'�n�a�m�e�'�,� �'�J�o�h�n� �D�o�e�'�)�;�
�
�
�
�
�#�#� �G�e�t�
�
�-� ��c�o�n�s�t� �v�a�l�u�e� �=� �a�w�a�i�t� �d�b�.�g�e�t�(�'�n�a�m�e�'�)�;�
�
�
�-� ��
��c�o�n�s�o�l�e�.�l�o�g�(�
�V�a�l�u�e�:� �$�{�v�a�l�u�e�}��)�;�
��
�
�
�
�
�#�#� �A�d�d�
�
�-� ��c�o�n�s�t� �i�n�c�r�e�m�e�n�t�e�d�V�a�l�u�e� �=� �a�w�a�i�t� �d�b�.�a�d�d�(�'�c�o�u�n�t�e�r�'�,� �5�)�;�
�
�
�-� ��
��c�o�n�s�o�l�e�.�l�o�g�(�
�I�n�c�r�e�m�e�n�t�e�d� �V�a�l�u�e�:� �$�{�i�n�c�r�e�m�e�n�t�e�d�V�a�l�u�e�}��)�;�
��
�
�
�
�
�#�#� �S�u�b�t�r�a�c�t�
�
�-� ��c�o�n�s�t� �d�e�c�r�e�m�e�n�t�e�d�V�a�l�u�e� �=� �a�w�a�i�t� �d�b�.�s�u�b�t�r�a�c�t�(�'�c�o�u�n�t�e�r�'�,� �2�)�;�
�
�
�-� ��
��c�o�n�s�o�l�e�.�l�o�g�(�
�D�e�c�r�e�m�e�n�t�e�d� �V�a�l�u�e�:� �$�{�d�e�c�r�e�m�e�n�t�e�d�V�a�l�u�e�}��)�;�
��
�
�
�
�
�#�#� �P�u�s�h�
�
�-� ��c�o�n�s�t� �u�p�d�a�t�e�d�L�i�s�t� �=� �a�w�a�i�t� �d�b�.�p�u�s�h�(�'�l�i�s�t�'�,� �'�i�t�e�m�1�'�,� �'�i�t�e�m�2�'�)�;�
�
�
�-� ��
��c�o�n�s�o�l�e�.�l�o�g�(�
�U�p�d�a�t�e�d� �L�i�s�t� �V�a�l�u�e�:� �$�{�u�p�d�a�t�e�d�L�i�s�t�}��)�;�
��
�
�
�
�
�#�#� �P�u�l�l�
�
�-� ��c�o�n�s�t� �n�e�w�L�i�s�t� �=� �a�w�a�i�t� �d�b�.�p�u�l�l�(�'�l�i�s�t�'�,� �'�i�t�e�m�1�'�)�;�
�
�
�-� ��
��c�o�n�s�o�l�e�.�l�o�g�(�
�U�p�d�a�t�e�d� �L�i�s�t� �V�a�l�u�e�:� �$�{�n�e�w�L�i�s�t�}��)�;�
��
�
�
�
�
�#�#� �D�e�l�e�t�e�
�
�-� ��d�b�.�d�e�l�e�t�e�(�'�n�a�m�e�'�)�;�
�
�
�
�
�#�#� �C�l�e�a�r�
�
�-� ��d�b�.�c�l�e�a�r�(�)�;�
�
�
�
�
�#� �H�e�r�e� �s�a�m�p�l�e� �c�o�d�e�
�
��
��
�
�c�o�n�s�t� �{� �E�x�p�r�e�s�s�D�B� �}� �=� �r�e�q�u�i�r�e�(�'�@�a�v�i�v�-�s�/�e�x�p�r�e�s�s�.�d�b�'�)�;�
�
�
�
�a�s�y�n�c� �f�u�n�c�t�i�o�n� �t�e�s�t�S�e�t�A�n�d�G�e�t�(�)� �{�
�
� � �c�o�n�s�t� �d�b� �=� �n�e�w� �E�x�p�r�e�s�s�D�B�(�)�;�
�
� � �t�r�y� �{�
�
� � � � �d�b�.�s�e�t�(�'�n�a�m�e�'�,� �'�J�o�h�n� �D�o�e�'�)�;�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�
�V�a�l�u�e�:� �$�{�a�w�a�i�t� �d�b�.�g�e�t�(�'�n�a�m�e�'�)�}��)�;�
�
� � �}� �c�a�t�c�h� �(�e�r�r�o�r�)� �{�
�
� � � � �c�o�n�s�o�l�e�.�e�r�r�o�r�(�
�E�r�r�o�r�:� �$�{�e�r�r�o�r�.�m�e�s�s�a�g�e�}��)�;�
�
� � �}� �f�i�n�a�l�l�y� �{�
�
� � � � �d�b�.�c�l�o�s�e�(�)�;�
�
� � �}�
�
�}�
�
�
�
�a�s�y�n�c� �f�u�n�c�t�i�o�n� �t�e�s�t�A�d�d�A�n�d�S�u�b�t�r�a�c�t�(�)� �{�
�
� � �c�o�n�s�t� �d�b� �=� �n�e�w� �E�x�p�r�e�s�s�D�B�(�)�;�
�
� � �t�r�y� �{�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�
�I�n�c�r�e�m�e�n�t�e�d� �V�a�l�u�e�:� �$�{�a�w�a�i�t� �d�b�.�a�d�d�(�'�c�o�u�n�t�e�r�'�,� �5�)�}��)�;�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�
�D�e�c�r�e�m�e�n�t�e�d� �V�a�l�u�e�:� �$�{�a�w�a�i�t� �d�b�.�s�u�b�t�r�a�c�t�(�'�c�o�u�n�t�e�r�'�,� �2�)�}��)�;�
�
� � �}� �c�a�t�c�h� �(�e�r�r�o�r�)� �{�
�
� � � � �c�o�n�s�o�l�e�.�e�r�r�o�r�(�
�E�r�r�o�r�:� �$�{�e�r�r�o�r�.�m�e�s�s�a�g�e�}��)�;�
�
� � �}� �f�i�n�a�l�l�y� �{�
�
� � � � �d�b�.�c�l�o�s�e�(�)�;�
�
� � �}�
�
�}�
�
�
�
�a�s�y�n�c� �f�u�n�c�t�i�o�n� �t�e�s�t�P�u�s�h�A�n�d�P�u�l�l�(�)� �{�
�
� � �c�o�n�s�t� �d�b� �=� �n�e�w� �E�x�p�r�e�s�s�D�B�(�)�;�
�
� � �t�r�y� �{�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�
�L�i�s�t� �V�a�l�u�e�:� �$�{�a�w�a�i�t� �d�b�.�g�e�t�(�'�l�i�s�t�'�)�}��)�;�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�
�U�p�d�a�t�e�d� �L�i�s�t� �V�a�l�u�e�:� �$�{�a�w�a�i�t� �d�b�.�p�u�s�h�(�'�l�i�s�t�'�,� �'�i�t�e�m�1�'�,� �'�i�t�e�m�2�'�)�}��)�;�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�
�L�i�s�t� �V�a�l�u�e�:� �$�{�a�w�a�i�t� �d�b�.�g�e�t�(�'�l�i�s�t�'�)�}��)�;�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�
�U�p�d�a�t�e�d� �L�i�s�t� �V�a�l�u�e�:� �$�{�a�w�a�i�t� �d�b�.�p�u�l�l�(�'�l�i�s�t�'�,� �'�i�t�e�m�1�'�)�}��)�;�
�
� � �}� �c�a�t�c�h� �(�e�r�r�o�r�)� �{�
�
� � � � �c�o�n�s�o�l�e�.�e�r�r�o�r�(�
�E�r�r�o�r�:� �$�{�e�r�r�o�r�.�m�e�s�s�a�g�e�}��)�;�
�
� � �}� �f�i�n�a�l�l�y� �{�
�
� � � � �d�b�.�c�l�o�s�e�(�)�;�
�
� � �}�
�
�}�
�
�
�
�a�s�y�n�c� �f�u�n�c�t�i�o�n� �t�e�s�t�D�e�l�e�t�e�(�)� �{�
�
� � �c�o�n�s�t� �d�b� �=� �n�e�w� �E�x�p�r�e�s�s�D�B�(�)�;�
�
� � �t�r�y� �{�
�
� � � � �d�b�.�d�e�l�e�t�e�(�'�n�a�m�e�'�)�;�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�
�V�a�l�u�e�:� �$�{�a�w�a�i�t� �d�b�.�g�e�t�(�'�n�a�m�e�'�)�}��)�;�
�
� � �}� �c�a�t�c�h� �(�e�r�r�o�r�)� �{�
�
� � � � �c�o�n�s�o�l�e�.�e�r�r�o�r�(�
�E�r�r�o�r�:� �$�{�e�r�r�o�r�.�m�e�s�s�a�g�e�}��)�;�
�
� � �}� �f�i�n�a�l�l�y� �{�
�
� � � � �d�b�.�c�l�o�s�e�(�)�;�
�
� � �}�
�
�}�
�
�
�
�a�s�y�n�c� �f�u�n�c�t�i�o�n� �t�e�s�t�C�l�e�a�r�(�)� �{�
�
� � �c�o�n�s�t� �d�b� �=� �n�e�w� �E�x�p�r�e�s�s�D�B�(�)�;�
�
� � �t�r�y� �{�
�
� � � � �d�b�.�c�l�e�a�r�(�)�;�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�
�V�a�l�u�e�:� �$�{�a�w�a�i�t� �d�b�.�g�e�t�(�'�c�o�u�n�t�e�r�'�)�}��)�;�
�
� � �}� �c�a�t�c�h� �(�e�r�r�o�r�)� �{�
�
� � � � �c�o�n�s�o�l�e�.�e�r�r�o�r�(�
�E�r�r�o�r�:� �$�{�e�r�r�o�r�.�m�e�s�s�a�g�e�}��)�;�
�
� � �}� �f�i�n�a�l�l�y� �{�
�
� � � � �d�b�.�c�l�o�s�e�(�)�;�
�
� � �}�
�
�}�
�
�
�
�a�s�y�n�c� �f�u�n�c�t�i�o�n� �m�a�i�n�(�)� �{�
�
� � �a�w�a�i�t� �t�e�s�t�S�e�t�A�n�d�G�e�t�(�)�;�
�
� � �a�w�a�i�t� �t�e�s�t�A�d�d�A�n�d�S�u�b�t�r�a�c�t�(�)�;�
�
� � �a�w�a�i�t� �t�e�s�t�P�u�s�h�A�n�d�P�u�l�l�(�)�;�
�
� � �a�w�a�i�t� �t�e�s�t�D�e�l�e�t�e�(�)�;�
�
� � �a�w�a�i�t� �t�e�s�t�C�l�e�a�r�(�)�;�
�
�}�
�
�
�
�m�a�i�n�(�)�;�
�
�
��
�