Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
orm-liteplus
Advanced tools
Readme
orm for sqlite3 in node.js
this is a simple orm for nodejs applications, which consists of updating, deleting, inserting and searching data. The project uses SQLITE3 as a parent dependency
first install orm into your project with npm
~# npm install orm-liteplus --save
then, import the library into your project.
const orm = require('orm-liteplus').sql; // for use without close data, use 'continuous' param
var db = new orm('./test.db'); //you can use :memory: too
- NOTE: after importing, start a builder to define which database to use. Currently, all sqlite formats are supported. learn more at sqlite3
if you have not yet created your database, you can create it using the create method and passing an array containing an object with information from the database tables to be created.
db.create([
{
type: 'table',
name: 'test',
coluns: {
id: 'INTEGER PRIMARY KEY',
name: 'TEXT NOT NULL',
email: 'TEXT NULL',
stamp: 'TEXT NULL'
}
},
{
type: 'table',
name: 'users',
coluns: {
id: 'INTEGER PRIMARY KEY',
name: 'TEXT NOT NULL',
email: 'TEXT NULL',
stamp: 'TEXT NULL',
active: 'TEXT NULL'
}
}
]).then(rest => {
console.log(rest)
}).catch(e => {
console.log(e)
})
type
: is the type of execution to be calledname
: is the name of the table to be createdcoluns
: are the columns to be created within the tableto insert data in your database, you need to define the parameters that your database will receive through a json.
db.insert([
{
"table": "test",
"values": [
{
"name": "victor",
"email": "victor.ratts@email.com",
"stamp": new Date().toUTCString()
}
]
},
{
"table": "users",
"values": [
{
"name": "victor",
"email": "victor.ratts@email.com",
"stamp": new Date().toUTCString(),
"active": 0
}
]
}
]).then(rest => {
console.log(rest)
}).catch(e => {console.log(e)})
the data selection uses a parameterization object to execute the desired query.
db.select({
colun: '*',
table: 'test',
//where: 'WHERE id = 2' /* you can define where condition */
}).then(rest => {
console.log(rest)
}).catch(e => {
console.log(e)
})
you can update data in masa or in a specific way using the update parameter next to an object containing information about the table to be updated.
db.update([
{
"table": "test",
"where": "WHERE id = 1",
"set": [
{
"name": "joao",
"email": "joao123@gmail.com"
}
]
}
])
to delete the inserted data, just use the delete parameter and pass an object containing information about the table and the data you want to delete.
db.delete([
{
"table": "test",
"where": "WHERE id = 1",
}
])
FAQs
orm for sqlite in nodejs
The npm package orm-liteplus receives a total of 2 weekly downloads. As such, orm-liteplus popularity was classified as not popular.
We found that orm-liteplus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.