
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
@jodu555/mysqlapi
Advanced tools
An NodeJS mysql wrapper to convert objects to the full query String! Nice to simplify the work with MySQL in a Node Enviroment
const { Database } = require('@jodu555/mysqlapi');
const database = Database.createDatabase('host', 'username', 'password', 'database');
database.connect();
database.createTable('tablename', {
options: {
PK: 'UUID',
},
columName: {
type: 'columType',
null: false,
},
});
database.createTable('services', {
options: {
PK: 'UUID',
K: ['name'],
FK: {
user_UUID: 'users/UUID',
},
},
UUID: {
type: 'varchar(64)',
null: false,
},
user_UUID: {
type: 'varchar(64)',
null: false,
},
name: 'varchar(64)',
});
database.createTable('services', {
options: {
//Enables softdelete
softdelete: true,
//Enable all available timestamps
timestamps: true,
//Enable only one or two with default naming only deletedAt if softdelete is activ
timestamps: {
cratedAt: true,
updatedAt: false,
deletedAt: true,
},
//Enable only one or two with custom colum naming only deletedAt if softdelete is activ
timestamps: {
cratedAt: 'created_at',
updatedAt: 'updated_at',
deletedAt: 'deleted_at',
},
PK: 'UUID',
},
UUID: {
type: 'varchar(64)',
null: false,
},
user_UUID: {
type: 'varchar(64)',
null: false,
},
name: 'varchar(64)',
});
const { Database } = require('@jodu555/mysqlapi');
const database = Database.getDatabase();
database. //some other function like get('tablename')
//Retunrs the created Entry
database.get('tablename').create({
columName: 'columValue',
});
//Returns one row
database.get('tablename').getOne({
searchColumName: 'searchColumValue',
});
//Returns an Array of rows
database.get('tablename').get({
searchColumName: 'searchColumValue',
});
//Returns the updated row
const update = await database.get('tablename').update(
{
searchColumName: 'searchColumValue',
},
{
updateColumName: 'updateColumValue',
}
);
await database.get('tablename').delete({
searchColumName: 'searchColumValue',
});
//Returns the latest inseted / updated / deleted row
//Gets the general latest
await database.get('tablename').getLatest('inserted');
await database.get('tablename').getLatest('updated');
await database.get('tablename').getLatest('deleted');
//Gets the latest by a specific search
await database.get('tablename').getLatest('type', {
searchColumName: 'searchColumValue',
});
database.registerCache(
'nameOfTheCache',
{
time: 1000 * 60 * 60, //After 1 Hour the cache gets refreshed
calls: 3, //After 4 cause 3 is inc. calls from the cache it gets refreshed
//These both values can work together or u only specify one of them
},
async (param) => {
//Here comes the code which gets called if the cache is initialized or refreshes
return {};
}
);
// To get a cached value
const output = await database.getCache('nameOfTheCache').get('value');
// This returns an object with infos about the calls the cachedTime and the data
// => { data: {}, calls: 1, cached: false, cacheTime: 1638083909074 }
//To Refresh the full cache with all kinds of passed parameters use:
database.getCache('nameOfTheCache').refresh();
//If you want to only refresh the cache for specific parameters use:
database.getCache('nameOfTheCache').refresh('param1');
/**
* IDENTIFIER Building:
ACTION: CREATE / GET / GETONE / UPDATE / DELETE / LATEST
Identifiers:
tablename-ACTION : On a Specific Table a specific Action
*-ACTION : On Any Table a specific Action
*-* : On any Table any Action
*/
database.setCallback('IDENTIFIER', ({ tablename, action, data }) => {
//Here you can log the data or do whatever you want to do
});
FAQs
Unknown package
We found that @jodu555/mysqlapi demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.