# easysqlite

> A simple SQLITE/SQLITE3 Wrapper for People who are new To Coding and maybe Experienced ones to make SQLITE Easier and to Handle Databases Easier!

Latest version **1.3.3** (published 2018-02-28) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install easysqlite
pnpm add easysqlite
yarn add easysqlite
bun add easysqlite
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.3.3 |
| Published | 2018-02-28 |
| First published | 2018-02-24 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 19.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | BoujeeFromDiscord |
| Maintainers | kevlarfromdiscord |
| Keywords | easy, sqlite, sqlite3, database, easy, database |

## Links

- npm: https://www.npmjs.com/package/easysqlite
- npm.io page: https://npm.io/package/easysqlite

## Dependencies (1)

- [sqlite3](https://npm.io/package/sqlite3.md) ^3.1.13

## Alternatives

- [@libsql/sqlite3](https://npm.io/package/@libsql/sqlite3.md) — 39.8K weekly downloads
- [@fortemi/core](https://npm.io/package/@fortemi/core.md) — 461 weekly downloads
- [cdb-converter](https://npm.io/package/cdb-converter.md) — 341 weekly downloads
- [@uplo/adapter-prisma](https://npm.io/package/@uplo/adapter-prisma.md) — 75 weekly downloads
- [typeorm-aios](https://npm.io/package/typeorm-aios.md) — 30 weekly downloads

## Recent versions

- 1.3.3 (latest) — 2018-02-28
- 1.3.2 — 2018-02-27
- 1.3.1 — 2018-02-26
- 1.3.0 — 2018-02-26
- 1.2.5 — 2018-02-26
- 1.2.4 — 2018-02-25
- 1.2.3 — 2018-02-25
- 1.2.2 — 2018-02-25
- 1.2.1 — 2018-02-25
- 1.2.0 — 2018-02-25
- 1.0.1 — 2018-02-25
- 1.0.0 — 2018-02-24
- 0.9.9 — 2018-02-24

## README

A simple SQLITE/SQLITE3 Wrapper for People who are new To Coding and maybe Experienced ones to make SQLITE Easier and to Handle Databases Easier!

[![NPM](https://nodei.co/npm/easysqlite.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/easysqlite/)

## Usage
**Note**: The module must be Installed first, before use.

| Parameter | Type | Optional | Default | Description |
| ------------- | ------------- | ------------- | ------------- | ------------- |
| options | Object | ✓ | none | Options for the Database Name and File Name |
| options.name | String | ✓ | 'database' | Sets the Database Name and File Name |
| options.arrname | String | ✓ | 'database_array' | Sets the Database Array Name and Array File Name |
| options.objname | String | ✓ | 'database_object' | Sets the Database Object Name and Object File Name |

**open**
```js
const EasySqlite = require('easysqlite'); // Require the Package
const db = new EasySqlite(); // Make a new Constructor with options
        
db.open('1234567890').then(i => { // Gets the Information on the Database of ID: 1234567890
    console.log(i); // Returns { id: '1234567890', value: 0, text: '' }
});
```
Returns [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>

**updateText**
```js
const EasySqlite = require('easysqlite'); // Require the Package
const db = new EasySqlite(); // Make a new Constructor with options
        
db.updateText('1234567890', 'Hello!').then(i => { // Updates the text of id: 1234567890
    console.log(i); // Returns { id: '1234567890', value: 0, text: 'Hello!' }
}); 
```
Returns [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>

**updateValue**
```js
const EasySqlite = require('easysqlite'); // Require the Package
const db = new EasySqlite(); // Make a new Constructor with options
        
db.updateValue('1234567890', 20).then(i => { // Adds 20 to the Value of id: 1234567890
    console.log(i); // Returns { id: '1234567890', value: 20, text: ' }
}); 
```
Returns [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>

**fetchArray**
```js
const EasySqlite = require('easysqlite'); // Require the Package
const db = new EasySqlite(); // Make a new Constructor with options

db.fetchArray('1234567890').then(i => { // Fetches the Array of ID: '1234567890'
    console.log(i); // Returns an Empty Array []
});
```
Returns [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)>

**setArray**
```js
const EasySqlite = require('easysqlite'); // Require the Package
const db = new EasySqlite(); // Make a new Constructor with options

db.setArray('1234567890', ['Hello', 'Hi!']).then(i => { // Adds the Array to the ID: 1234567890
    console.log(i); // Returns the Array ['Hello', 'Hi!']

    // Take Note: If there is an item in the elements, ( e.g 3rd element has 'XD' ) it will replace it
});
```
Returns [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)>

**fetchObject**
```js
const EasySqlite = require('easysqlite'); // Require the Package
const db = new EasySqlite(); // Make a new Constructor with options

db.fetchObject('12345').then(i => {
    console.log(i); // Returns: { id: '12345', obj: {} }
});
```
Returns [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>

**setObject**
```js
const EasySqlite = require('easysqlite'); // Require the Package
const db = new EasySqlite(); // Make a new Constructor with options

db.setObject('12345', { a_key: 'a_value' }).then(i => {
    console.log(i); // Returns: { id: '12345', obj: { a_key: 'a_value' } }
});
```
Returns [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>

## What's New in 1.3.3?
  - **We have added a workaround for the manual `JSON.parse()` at your code**  
  - **Instead of null on empty object at `fetchObject()` it will just return an empty object**  
  - **Fixed where, when you add the File Name options, it doesn't set it**
  - **New Owner, `kevlarfromdiscord`**

## Have any Problems?
**Join [Here](https://discord.gg/B4DZERQ) for us to resolve your Problems!**

---
_Source: https://npm.io/package/easysqlite · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
