{"id":18385,"library":"gimlet","title":"Gimlet","description":"Gimlet is a Node.js module that provides a lightweight database access layer on top of common drivers like MySQL. It adds high-level validations, helper methods (create, remove, queryRow, queryOne), and Record instances with change tracking, saving, and freezing capabilities. As of v2.1.0, it is actively maintained with gradual updates. Unlike ORMs/ODMs, developers write raw SQL queries. Dependencies: mysql driver must be installed separately.","status":"active","version":"2.1.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/dresende/gimlet","tags":["javascript","database","driver","mysql","cache"],"install":[{"cmd":"npm install gimlet","lang":"bash","label":"npm"},{"cmd":"yarn add gimlet","lang":"bash","label":"yarn"},{"cmd":"pnpm add gimlet","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for MySQL driver support","package":"mysql","optional":false}],"imports":[{"note":"ESM requires Node >=16 or type: module. CJS require still works.","wrong":"const gimlet = require('gimlet')","symbol":"default","correct":"import gimlet from 'gimlet'"},{"note":"Default export is the constructor/object.","wrong":"import { Gimlet } from 'gimlet'","symbol":"Gimlet","correct":"import Gimlet from 'gimlet'"},{"note":"Named export for Point/Polygon types.","wrong":"import types from 'gimlet/types'","symbol":"types","correct":"import { types } from 'gimlet'"}],"quickstart":{"code":"import gimlet from 'gimlet';\nimport mysql from 'mysql'; // must install separately\n\nconst connection = gimlet.connect('mysql://user:pass@localhost/db');\nconst handler = connection.handler();\n\nhandler.query('SELECT * FROM users', (err, users) => {\n  if (err) throw err;\n  console.log(users[0] instanceof gimlet.Record); // true\n  console.log(users[0].name);\n  users[0].name = 'Updated';\n  users[0].save(err => console.log('saved'));\n});","lang":"javascript","description":"Connect to MySQL, query users, modify a record, and save changes."},"warnings":[{"fix":"Call connection.open(cb) if you need immediate connection check.","message":"gimlet.connect() does not immediately connect for MySQL; first query triggers connection.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use driver-specific POINT handling if stability is critical.","message":"gimlet types Point/Polygon constructor may change in future; prefer plain objects if possible.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Ensure connection is open before calling save, or handle errors.","message":"Record.save() will fail if connection is closed or pool drained.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install gimlet","cause":"Package not installed or missing from node_modules","error":"Cannot find module 'gimlet'"},{"fix":"Start MySQL or verify connection string: mysql://user:pass@localhost:3306/db","cause":"MySQL server not running or incorrect host/port","error":"Error: connect ECONNREFUSED"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}