Skip to content

Commit

Permalink
chore(sql): first working version
Browse files Browse the repository at this point in the history
  • Loading branch information
nfroidure committed Aug 19, 2020
0 parents commit ce952ec
Show file tree
Hide file tree
Showing 20 changed files with 13,469 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file is automatically generated by a `metapak`
# module. Do not change it elsewhere, changes would
# be overridden.
engines:
eslint:
enabled: true

ratings:
paths:
- "src/*.ts"
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file is automatically generated by a `metapak`
# module. Do not change it elsewhere, changes would
# be overridden.

# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
# 2 space indentation
[*.{js,css}]
charset = utf-8
indent_style = space
trim_trailing_whitespace = true
indent_size = 2
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.md text eol=lf
*.html text eol=lf
*.js text eol=lf
9 changes: 9 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Code of Conduct

Be kind, except if I behave like an asshole, if so, tell me by linking to this
file.

I try hard to document and automate things so that you cannot create noises
without really willing to do so.

This is why I'll just delete issues/comments making be sad.
8 changes: 8 additions & 0 deletions .github/CONTRIBUTING
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Contributing to this project requires you to be
a gentleman.

By contributing you must agree with publishing your
changes into the same license that apply to the current code.

You will find the license in the LICENSE file at
the root of this repository.
59 changes: 59 additions & 0 deletions .github/ISSUE_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
## Issue
<!--

Thanks for reporting an issue.

Before doing so, there are a few checks to do in
order to optimize its resolution. Just fill in the
following template.

Beware that you also can create a pull request
if you know how to solve the issue.

Finally scroll down if you are asking for a new feature ;)

-->

I'm a gentledev I:
- [ ] fully read the README recently
- [ ] searched for existing issues
- [ ] checked I'm up to date with the latest version of the project

### Expected behavior

### Actual behavior

### Steps to reproduce the behavior

### Debugging informations
- `node -v` result:
```
<paste here>
```

- `npm -v` result:
```
<paste here>
```
If the result is lower than 10.19.0, there is
poor chances I even have a look to it. Please,
use the last [NodeJS LTS version](https://nodejs.org/en/).

## Feature request
<!--

If you think a feature need to be added, your suggestions
are welcome. Beware though that:
- I try to keep my modules simple so please ensure the requested
feature is really related to this module. If not, you may
instead create a module that augment/work with this one,
- I am not your employee so keep calm and be aware that your
request may stay incomplete for ever. Nothing impeach you
to implement the feature and get it merged though.
-->

### Feature description

### Use cases

- [ ] I will/did implement the feature
51 changes: 51 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!--

Thanks for improving this project!

Before doing so, there are a few checks to do in
order to get your PR merged asap. Just fill in the
following template.

-->

Fixes #

### Proposed changes
-
-

<!-- Check the boxes with a `x` like so `[x]` -->

### Code quality
- [ ] I made some tests for my changes
- [ ] I added my name in the
[contributors](https://docs.npmjs.com/files/package.json#people-fields-author-contributors)
field of the `package.json` file. Beware to use the same format than for the author field
for the entries so that you'll get a mention in the `README.md` with a link to your website.

### License
To get your contribution merged, you must check the following.

- [ ] I read the project license in the LICENSE file
- [ ] I agree with publishing under this project license

<!--

If you already maintain several NPM modules / NodeJS
project, making significant changes on one of my modules
automatically legitimates you as a core developer.

This is because I could die or even not give a shit to
this project someday and I don't want people to get
stuck in such cases.

If you want to help, fill the following with to get
GitHub/NPM r/w access.

-->
### Join
- [ ] I wish to join the core team
- [ ] I agree that with great powers comes responsibilities
- [ ] I'm a nice person

My NPM username:
132 changes: 132 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# This file is automatically generated by a `metapak`
# module. Do not change it elsewhere, changes would
# be overridden.

# Created by https://www.gitignore.io/api/osx,node,linux

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

### OSX ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


# End of https://www.gitignore.io/api/osx,node,linux

# Coveralls key
.coveralls.yml

# Project custom ignored file
dist
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file is automatically generated by a `metapak`
# module. Do not change it elsewhere, changes would
# be overridden.

language: node_js
node_js:
- 10
- 10.19.0
- 11
- 12
31 changes: 31 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[//]: # ( )
[//]: # (This file is automatically generated by the `jsarch`)
[//]: # (module. Do not change it elsewhere, changes would)
[//]: # (be overriden.)
[//]: # ( )
# Architecture Notes



## Tagged template queries

The `pg` module uses simple `$n` placeholder for queries values
that are provided in an array.

This tagged template function adds a level of abstraction
transforming the following expression:
`sql\`SELECT * FROM users WHERE id=${userId}\`` with `userId=1` }
into `{ text: 'SELECT * FROM users WHERE id=$1', values: [1] }`
under the hood.

[See in context](./src/lib.ts#L168-L178)



## Checking SQL syntax

Its purpose it to ensure queries made with the `sql` tag are well
formed while running your unit tests.

[See in context](./src/mock.ts#L14-L18)

20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright © 2017 Nicolas Froidure

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

0 comments on commit ce952ec

Please sign in to comment.