{"_id":"@carocad/hugsql","_rev":"3-3c6d4c0796f9d308a5000a042221197d","name":"@carocad/hugsql","dist-tags":{"latest":"1.1.0"},"versions":{"0.1.0":{"name":"@carocad/hugsql","version":"0.1.0","description":"Node.js library for embracing SQL","author":{"name":"Camilo Roca"},"homepage":"https://github.com/carocad/hugsql","repository":{"type":"git","url":"https://github.com/carocad/hugsql"},"license":"LGPL-3.0-only","bin":{"hugsql":"src/cli.js"},"scripts":{"lint":"eslint .","test":"yarn run lint && jest --collectCoverage"},"dependencies":{"docopt":"^0.6.2","mustache":"^3.0.3"},"devDependencies":{"eslint":"^6.3.0","eslint-config-airbnb-base":"^14.0.0","eslint-plugin-import":"^2.18.2","jest":"^24.9.0"},"engines":{"node":">=10.10"},"_id":"@carocad/hugsql@0.1.0","dist":{"shasum":"3feeeac69b1d1868f1dd7c39f4215c1feb857f19","integrity":"sha512-pz5JWQJLu4rjDEI1Llx5VmmLHCE7LCirZu6z2kDyDA6cmsAHafyMtyRULnP1r8u58q4u4/LUd3F+wn6CFjzx0Q==","tarball":"https://registry.npmjs.org/@carocad/hugsql/-/hugsql-0.1.0.tgz","fileCount":19,"unpackedSize":27916,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJde6MaCRA9TVsSAnZWagAAwSIQAIIL4gd7HMO9n4b8fd0Z\nPoDFsroGf2p2yils9BOSd3byr4aX6mSehtMeFEcM5EKpLJFxafOTYL0kru6S\nwM/BzH7g41QaV3eBOFc1aXuj92/0SYRkmVGMei9jo+k6wNCP4dfWylJPKk7A\nhVY0BlPpQD/JdhaIM8aXdFG3uee+YE0ryUYZf8iWV2OGs+8tZSOZCkjPrH6+\nvryPIfoAQxUzn0umJX85GgvGJz0Ou/x1vkyfhEVM7OIcjio6wESk0EcroML1\nGXcY/c8dIbTNdPB6Dj94QVAKcz2HJLjOhkKVGUT3qg+4YJ9/2FP+FNFFblaK\ni5Ss/xHzeEBUidKYVr8N0HDF7t858swOKYT4X8jmiC7d113JQe22KgQQBHDn\n7TckQR8chOK/TuWbKpJI+7apaHfT2u315tmFCDGhUQyY4pUwZV29TiQBUJBB\nPUb+BRmWn1oZ/8sqBoT1AYeq0LQHRpQHkNba7EYvhHD5jtxBklo3jjZVNGUI\nPgKANFZCAmVwMFANnl+ntLD5fyBKEhL7Xpp5QvCNXqq2GKvtir6T6wp6fdf9\n+Inf5NhMbTA4NnFZJ5ssMvMCfgGSGw4AATxaLxTtxM0kbiFO7tL0eAcKChdB\nnjlYhAQ/25D0BTFiY3DRCYCYhYIMObSrZWEJYM0r/9xpuqwfxeK2gV6RpJBP\nwJVo\r\n=DNIE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIATJwvFm44j58wVv1ptMzTexWn+R5su3tpsDj5OPmBx3AiAHAdr49jAv7xZHRh90Xg4lNzbIY2vVLu98PNV9lVMkJg=="}]},"maintainers":[{"name":"carocad","email":"hello@carocad.dev"}],"_npmUser":{"name":"carocad","email":"hello@carocad.dev"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hugsql_0.1.0_1568383769425_0.40202567685929425"},"_hasShrinkwrap":false},"1.0.0":{"name":"@carocad/hugsql","version":"1.0.0","description":"Node.js library for embracing SQL","author":{"name":"Camilo Roca"},"homepage":"https://github.com/carocad/hugsql","repository":{"type":"git","url":"git+https://github.com/carocad/hugsql.git"},"license":"LGPL-3.0-only","bin":{"hugsql":"src/cli.js"},"scripts":{"test":"npx eslint . && jest --collectCoverage"},"dependencies":{"docopt":"^0.6.2","handlebars":"^4.7.3"},"devDependencies":{"eslint":"^6.3.0","eslint-config-airbnb-base":"^14.0.0","eslint-plugin-import":"^2.18.2","jest":"^24.9.0","semantic-release":"^17.0.4"},"engines":{"node":">=10.10"},"gitHead":"dc1a247efd6a4392ea9443dc97c250dac03a1fd6","bugs":{"url":"https://github.com/carocad/hugsql/issues"},"_id":"@carocad/hugsql@1.0.0","_nodeVersion":"10.19.0","_npmVersion":"6.14.3","dist":{"integrity":"sha512-pdpdSGkALXlx+Fn6i4Z5JWI0uE4D4HVUmUs1tfWVEom4vyl3UpcWSi/SrLEyuSriGquxv7kXg/8+kVmbMH7J3Q==","shasum":"cff57d82665fc7e48dce03bef7dd57c929637f91","tarball":"https://registry.npmjs.org/@carocad/hugsql/-/hugsql-1.0.0.tgz","fileCount":14,"unpackedSize":35526,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJedTDNCRA9TVsSAnZWagAAGgMQAIQ7gh8Q7wrFYz+Fd17U\nlpMCb88vJ5IuuoTD0feFVz1Buca98tstjdt/vUMmlzn/h71W4629+tSA/9w/\ndbreUDltvWTJH4AFEPHohYEc+j/bvU1GYWRgDX3KoFcN2E2Wf3l/lT7CmUuT\nSqYKZFDnUdfWl8sJfo1rq9E8xqpaeBYTapUuuXTtBsPz+uhpy8EWWPP2N2Be\nODs2Yzu6J12jQkDRjO6fn6PHaiK6HHCe+iJ4iLBY9EDKO5EJY8T/iYZ6wn0z\nLFSSKgIdHlfInvxoVoFn3sbfwfG0hjQZXYpGWlNpTh6UXcZX1oLngfiwTt1Q\nvJikw3DThDG7A6Vu0DmSAc0QcBxcSy3Ehage/ezoazPepEhMWE2u5qx31FeI\nvn8ms2hmUOV+WedY8AlwEjlb3ASPv+j0MUXPoKK1eCdX1/+wEkgfILtptqce\nb53iV2eDYz+Dr7pH42/fvQOMWs6lYDLaGiBh48h+Tpr5Zvqwtvsay7PFxkgb\n1cAk+d0GUUCECq8HSV5rqs0qRAmeWVLAMLHzASNG2e0yvZXwLkFBX3DLEPfx\nQmGOOdbr2ICA6WEkBy5XSvnxQ9jBiBR7gxxHcqj3/luSEO4ZquQstL59SZor\nsxGAlwumsuJUQutdte4BwXo2NUK6RVlbwujQEwGKFGnhoX0P2GZDVBp87XYl\nfP/o\r\n=jNYr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCT4CF3tACIiQWk9JlgKhTA1+VHkJLj3znuPb1bvlLHWgIgey+znaeGke45FoKRWX6IwWW8gzOcqSzfMWSR5fKNuZk="}]},"maintainers":[{"name":"carocad","email":"hello@carocad.dev"}],"_npmUser":{"name":"carocad","email":"hello@carocad.dev"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hugsql_1.0.0_1584738509160_0.6357640778470435"},"_hasShrinkwrap":false},"1.1.0":{"name":"@carocad/hugsql","version":"1.1.0","description":"Node.js library for embracing SQL","author":{"name":"Camilo Roca"},"homepage":"https://github.com/carocad/hugsql","repository":{"type":"git","url":"git+https://github.com/carocad/hugsql.git"},"license":"LGPL-3.0-only","bin":{"hugsql":"src/cli.js"},"scripts":{"test":"npx eslint --fix . && jest --collectCoverage"},"dependencies":{"docopt":"^0.6.2","handlebars":"^4.7.3"},"devDependencies":{"eslint":"^6.3.0","eslint-config-airbnb-base":"^14.0.0","eslint-plugin-import":"^2.18.2","jest":"^24.9.0","semantic-release":"^17.0.4"},"engines":{"node":">=10.10"},"gitHead":"25a3a0a7f1d134da89bba423b0e97183af388be1","bugs":{"url":"https://github.com/carocad/hugsql/issues"},"_id":"@carocad/hugsql@1.1.0","_nodeVersion":"10.19.0","_npmVersion":"6.14.3","dist":{"integrity":"sha512-yYxIF2qLFki81sumMszpgXDPNcV+VQZyEuQ7afENBIA2pSBuVCX9WIogSpCvQb1o9SjuXbRRNxT5rdRhFc8+AA==","shasum":"143560764be2d9210ebba79087fc33fa9e8ffff6","tarball":"https://registry.npmjs.org/@carocad/hugsql/-/hugsql-1.1.0.tgz","fileCount":14,"unpackedSize":35330,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJedUOoCRA9TVsSAnZWagAAZ6EQAIvZrokhvPTV3sblbY73\nVsT8RaOZjgZafqr3R8njWsDQEJQHrXxe5RDFn98aC0sfdrUGVvaeo9zaZxIY\nieGXatxwGAMRtRGAFTEZBfOmr8iSpaz0JVx3BPDjdVcJQLJRPu9gM4nuYAgY\ngThxd9c3k5OkXUNWxR4aHLy2lN9rFuzNB3F3oyGw0e+TymSAv37Sd9anRj8s\ntZ/hfjmJV9BwiNw4h4cLdYEloK7PdxcWETRqmCaDsf4M6bQ6YNPS9eSyBCKw\nv7hR1mlgpVzN6U3mmmaN/aCgFb0RSnZObj3odkU77JHlfGfXp8ejGfhDI1u8\nwXAX/3tkmErP+VQHiTPAvfFWPYNUQf65bc0FqvmiZglWGYS0sKhLmM9dDRnZ\nLxCCQTCaAGsEHdTW4zLZGCB144nehPyBDBhEIYmrrkqA4iDAiv8Ct4K1ZrgD\n5pNyWIlhdkCHj3lLB1gwOSSZkevp1WebEubsYa7hEZx7bq6W1smxe+BMw2Xp\nXjfid8De2GprNS5MjY3Cg57LKwrCyeVHLQXzECgOWvm6iY4TyEuqTVKuSHmc\n0MGhJxYayjSETfcRI52YO4LhdeCqK8BLTKhM164xmzDznRWZcrc/DT1FREc9\n1HKGowkft/bDB0518KoNyKwrDOuAbLLP+1RdqFJlrnp7VHae05mYNTXwwry6\no+82\r\n=Rcya\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDXXVdJHio2PrRCjQ6dUBDJSNb1/PZjMH7bcK0kmworVQIgRB8uvaFKu6Dtq24PiZ33ndd9v5nip5iFj1lmONC/C50="}]},"maintainers":[{"name":"carocad","email":"hello@carocad.dev"}],"_npmUser":{"name":"carocad","email":"hello@carocad.dev"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hugsql_1.1.0_1584743335602_0.7494953391947254"},"_hasShrinkwrap":false}},"time":{"created":"2019-09-13T14:09:29.174Z","0.1.0":"2019-09-13T14:09:29.714Z","modified":"2022-04-04T21:58:42.837Z","1.0.0":"2020-03-20T21:08:29.253Z","1.1.0":"2020-03-20T22:28:55.710Z"},"maintainers":[{"name":"carocad","email":"hello@carocad.dev"}],"description":"Node.js library for embracing SQL","homepage":"https://github.com/carocad/hugsql","repository":{"type":"git","url":"git+https://github.com/carocad/hugsql.git"},"author":{"name":"Camilo Roca"},"license":"LGPL-3.0-only","readme":"# HugSql\n\nNode.js library for embracing SQL.\n\n[![Build Status](https://travis-ci.com/carocad/hugsql.svg?branch=master)](https://travis-ci.com/carocad/hugsql)\n[![npm version](https://badge.fury.io/js/%40carocad%2Fhugsql.svg)](https://badge.fury.io/js/%40carocad%2Fhugsql)\n\nHugSql is my own adaptation of the wonderful [HugSql](https://github.com/layerware/hugsql)\nlibrary for Clojure.\n\n- SQL is the right tool for the job when working with a relational database!\n- HugSQL uses JsDoc style documentation in your SQL files to\n  define (at compile time) database functions in your Javascript Modules,\n  creating a clean separation of Javascript and SQL code\n- HugSQL relies on battle tested SQL client implementations for Node.js\n  to provide proper value replacement and escaping with security\n  \nStop using complicated frameworks that transform your queries in unexpected ways. Instead\njust use plain Sql statements and enjoy the benefits of *What You See Is What You Get*.\n\nAs an added benefit you can directly use all the tooling available for your Sql dialect\nand the one available for Node.js without compromising on quality :) \n\n### Usage\n\n- install it\n```Shell\nnpm install --save-dev @carocad/hugsql\n```\n\n- Document your SQL statements with JsDoc annotations. HugSql will then create\nJavascript functions with the appropriate documentation and parameters. For example on `src/example.sql` file\n```SQL\n/**\n * Fetch all the albums from a specific artist ...\n * you better pick a good one ;)\n * @function findAllAlbums\n * @param {Number} artistId - an artist id\n * @param {Number} albumId - an album id\n */\nselect * from albums where \"AlbumId\" = :albumId and \"ArtistId\" = :artistId;\n```\n\n- run *hugsql* on the command line\n```Shell\n# point it to the directory containing your *.sql files\nnpx hugsql src/\n```\n\n- you get an autogenerated `src/example.sql.js` file\n```js\nconst statements = {\n    /**\n     * Fetch all the albums from a specific artist ...\n     * you better pick a good one ;)\n     * \n     * @param {Number} artistId - an artist id\n     * @param {Number} albumId - an album id\n     */\n    findAllAlbums: (artistId,albumId) => ({\n        query: 'select * from albums where \"AlbumId\" = ? and \"ArtistId\" = ?;',\n        parameters: [ albumId,artistId ]\n    })\n}\n\nmodule.exports = statements\n```\n\n- then you can use it like (example using [MySql](https://github.com/mysqljs/mysql))\n```js\nconst mysql      = require('mysql');\n// import your autogenerated code\nconst statements = require('./src/example.sql.js');\n\nconst connection = mysql.createConnection({ ... });\n\nconst myFavouriteSongs = statements.findAllAlbums('Calle 13', 'Multi Viral');\nconnection.query(MyFavouriteSongs.query, myFavouriteSongs.parameters, function (error, results, fields) {\n  console.log('Here we kum: ', results);\n})\n```\n\n- Enjoy :)\n\nFor more examples, check the [example queries](./test/sql) used to test\nhugsql\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/carocad/hugsql/issues"}}