Skip to content

Instantly share code, notes, and snippets.

View abdulrahmanAlotaibi's full-sized avatar
🎨
Programming

Abdulrahman Alotaibi abdulrahmanAlotaibi

🎨
Programming
  • Riyadh, KSA
  • 18:08 (UTC -12:00)
View GitHub Profile
@abdulrahmanAlotaibi
abdulrahmanAlotaibi / knexjs.js
Last active September 10, 2021 20:55
Knex.js Query Builder - Queries Cheatsheet
/**
* @Desc : All of my data are seeded using this testing database(https://github.com/datacharmer/test_db) just import it to your local database server
*/
const knex = require("knex")
const db = knex(require("./knexfile")["development"])
const { bgCyan, bgRed, redBright, bold, underline } = require("colorette") // To add colors for stdout text
db.from("departments").select("*").first().then(res => {
console.log(bgCyan("Basic select:"))
console.log(res)