Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

prisma.db mysql

const { MysqlDatabase } = require("prisma.db");
const db = new MysqlDatabase({
    host: "...",
    user: "...",,
    password: "...",,
    database: "...",
});

db.tableList();  /* Object: {table...} */ 
db.tableSet(`CREATE TABLE IF NOT EXISTS...`);  /* Boolean: true */ 
db.tableDelete("users");  /* Boolean: true */ 

db.set("users", { name: "Raphael" }); /* Boolean: true */ 
db.update("users", "name", "Raffaello" , { name: "Raffaello Sanzio", });  /* Boolean: true */ 

db.fetch("users", "name", "Raphael"); /* returns { hello: "world" } */ 
db.has("users", "name", "Raphael"); /* Boolean: true */ 

db.delete("users", "name", "Raphael"); /* Boolean: true */ 
db.destroy(); // Database connect is closed
db.clear("users"); /* Boolean: true */ 
db.size("users"); /* returns 1 */
 
PREVIOUS NEXT
Tagged: #mysql
ADD COMMENT
Topic
Name
3+7 =