Git Product home page Git Product logo

easydb.js's Introduction

easyDB.js

easyDB.js is a simple Node.js package for working with SQLite databases. It provides an easy-to-use API for common database operations.

Installation

To install easyDB.js, run the following command:

npm install easyDB.js

## API Documentation

EasyDB
new EasyDB(databasePath)
Description: Creates a new instance of EasyDB.

databasePath: The path to the SQLite database file (e.g., 'path/to/your/database.sqlite').
easyDB.createTable(tableName, schema)
Description: Creates a new table with the given schema.

tableName: The name of the table to create (e.g., 'users').
schema: An object representing the table schema (e.g., { id: 'INTEGER PRIMARY KEY', name: 'TEXT', email: 'TEXT' }).
Returns: A Promise that resolves when the table is created.

easyDB.insert(tableName, data)
Description: Inserts a new record into the specified table.

tableName: The name of the table to insert the record into (e.g., 'users').
data: An object representing the record data (e.g., { name: 'John Doe', email: '[email protected]' }).
Returns: A Promise that resolves when the record is inserted.

easyDB.find(tableName, conditions)
Description: Finds records in the specified table that match the given conditions.

tableName: The name of the table to query (e.g., 'users').
conditions: An object representing the query conditions (e.g., { name: 'John Doe' }).
Returns: A Promise that resolves with an array of matching rows.

easyDB.update(tableName, data, conditions)
Description: Updates records in the specified table that match the given conditions.

tableName: The name of the table to update (e.g., 'users').
data: An object representing the new data (e.g., { email: '[email protected]' }).
conditions: An object representing the update conditions (e.g., { name: 'John Doe' }).
Returns: A Promise that resolves when the records are updated.

easyDB.delete(tableName, conditions)
Description: Deletes records from the specified table that match the given conditions.

tableName: The name of the table to delete records from (e.g., 'users').
conditions: An object representing the delete conditions (e.g., { name: 'John Doe' }).
Returns: A Promise that resolves when the records are deleted.

easyDB.close()
Description: Closes the database connection.

Returns: A Promise that resolves when the database connection is closed.

easydb.js's People

Contributors

zeyadsalah686 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.