Skip to content

Commit 9608fde

Browse files
committed
Prettier everything
1 parent bbc83a9 commit 9608fde

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+963
-886
lines changed

.prettierrc.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
semi: false
2+
singleQuote: true
3+
trailingComma: all
4+
printWidth: 100

packages/any-db-adapter-spec/README.md

+51-48
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ implement.
1111

1212
## Interfaces
1313

14-
- [Queryable][] - a common interface implemented by connections, pools, and
15-
transactions.
16-
- [Connection][] - the "transport" responsible for getting SQL queries to a
17-
database, and streaming results back through a `Query` instance.
18-
- [Query][] - a [Readable][] stream that emits row objects.
14+
- [Queryable][] - a common interface implemented by connections, pools, and
15+
transactions.
16+
- [Connection][] - the "transport" responsible for getting SQL queries to a
17+
database, and streaming results back through a `Query` instance.
18+
- [Query][] - a [Readable][] stream that emits row objects.
1919

2020
## Callbacks
2121

@@ -38,9 +38,10 @@ Queryable := EventEmitter & {
3838
```
3939

4040
Known implementations:
41-
- [Connection][Connection]
42-
- [ConnectionPool][ConnectionPool] (external)
43-
- [Transaction][Transaction] (external).
41+
42+
- [Connection][connection]
43+
- [ConnectionPool][connectionpool] (external)
44+
- [Transaction][transaction] (external).
4445

4546
### Queryable.adapter
4647

@@ -64,21 +65,26 @@ The second form is not needed for normal use, but must be implemented by
6465
adapters to work correctly with [ConnectionPool][] and [Transaction][]. See
6566
[Adapter.createQuery](#adapter-createquery) for more details.
6667

67-
*Callback-style*
68+
_Callback-style_
69+
6870
```javascript
69-
queryable.query('SELECT * FROM my_table', function (err, res) {
71+
queryable.query('SELECT * FROM my_table', function(err, res) {
7072
if (err) return console.error(err)
7173
res.rows.forEach(console.log)
7274
console.log('All done!')
7375
})
7476
```
7577

76-
*Stream-style*
78+
_Stream-style_
79+
7780
```javascript
78-
queryable.query('SELECT * FROM my_table')
81+
queryable
82+
.query('SELECT * FROM my_table')
7983
.on('error', console.error)
8084
.on('data', console.log)
81-
.on('end', function () { console.log('All done!') })
85+
.on('end', function() {
86+
console.log('All done!')
87+
})
8288
```
8389

8490
### Queryable events
@@ -89,7 +95,7 @@ The `'query'` event is emitted immediately before a query is executed.
8995

9096
One argument is passed to event handlers:
9197

92-
* `query` - a [Query][] object
98+
- `query` - a [Query][] object
9399

94100
## Connection
95101

@@ -101,9 +107,9 @@ Connection := Queryable & {
101107

102108
Known implementations:
103109

104-
- [any-db-mysql][] (external)
105-
- [any-db-postgres][] (external)
106-
- [any-db-sqlite3][] (external)
110+
- [any-db-mysql][] (external)
111+
- [any-db-postgres][] (external)
112+
- [any-db-sqlite3][] (external)
107113

108114
Connection objects are obtained using [createConnection][] from [Any-DB][] or
109115
[ConnectionPool.acquire][], both of which delegate to the
@@ -154,32 +160,32 @@ Query := Readable<Object> & {
154160
}
155161
```
156162

157-
`Query` objects are returned by the [Queryable.query][Queryable.query] method,
158-
available on [connections][Connection], [pools][ConnectionPool.query], and
159-
[transactions][Transaction.query]. Queries are instances of [Readable][], and
160-
as such can be [piped][Readable.pipe] through transforms and support backpressure
163+
`Query` objects are returned by the [Queryable.query][queryable.query] method,
164+
available on [connections][connection], [pools][connectionpool.query], and
165+
[transactions][transaction.query]. Queries are instances of [Readable][], and
166+
as such can be [piped][readable.pipe] through transforms and support backpressure
161167
for more efficient memory-usage on very large results sets. (Note: at this time
162168
the `sqlite3` driver does not support backpressure)
163169

164170
Internally, `Query` instances are
165-
[created by a database Adapter][Adapter.createQuery] and may have more methods,
171+
[created by a database Adapter][adapter.createquery] and may have more methods,
166172
properties, and events than are described here. Consult the documentation for
167173
your specific adapter to find out about any extensions.
168174

169175
### Query.text
170176

171177
The SQL query as a string. If you are using MySQL this will contain
172-
interpolated values *after* the query has been enqueued by a connection.
178+
interpolated values _after_ the query has been enqueued by a connection.
173179

174180
### Query.values
175181

176182
The array of parameter values.
177183

178184
### Query.callback
179185

180-
The callback (if any) that was provided to [Queryable.query][Queryable.query].
186+
The callback (if any) that was provided to [Queryable.query][queryable.query].
181187
Note that `Query` objects **must not** use a closed over reference to their
182-
callback, as other `any-db` libraries *may* rely on modifying the `callback`
188+
callback, as other `any-db` libraries _may_ rely on modifying the `callback`
183189
property of a `Query` they did not create.
184190

185191
### Query Events
@@ -192,15 +198,15 @@ be subscribed to the `'error'` event.
192198

193199
One argument is passed to event listeners:
194200

195-
* `error` - the error object.
201+
- `error` - the error object.
196202

197203
#### Fields event
198204

199205
A `'fields'` event is emmitted before any `'data'` events.
200206

201207
One argument is passed to event listeners:
202208

203-
* `fields` - an array of [Field][ResultSet] objects.
209+
- `fields` - an array of [Field][resultset] objects.
204210

205211
### [Readable][] events
206212

@@ -212,7 +218,7 @@ A `'data'` event is emitted for each row in the query result set.
212218

213219
One argument is passed to event listeners:
214220

215-
* `row` contains the contents of a single row in the query result
221+
- `row` contains the contents of a single row in the query result
216222

217223
#### Close event
218224

@@ -242,7 +248,7 @@ Field := {
242248
}
243249
```
244250

245-
`ResultSet` objects are just plain data that collect results of a query when a
251+
`ResultSet` objects are just plain data that collect results of a query when a
246252
continuation is provided to [Queryable.query][]. The `lastInsertId` is optional,
247253
and currently supported by `sqlite3` and `mysql` but not `postgres`, because
248254
it is not supported by Postgres itself.
@@ -283,7 +289,7 @@ See also: the [Connection API](#connection)
283289
(Query) => Query {* returns same Query *}
284290
```
285291

286-
Create a [Query](#query) that *may* eventually be executed later on by a
292+
Create a [Query](#query) that _may_ eventually be executed later on by a
287293
[Connection][]. While this function is rarely needed by user code, it makes
288294
it possible for [ConnectionPool.query][] and [Transaction.query][] to fulfill
289295
the [Queryable.query][] contract by synchronously returning a [Query][] stream.
@@ -299,23 +305,20 @@ the [Queryable.query][] contract by synchronously returning a [Query][] stream.
299305
[any-db-mysql]: https://github.com/grncdr/node-any-db-mysql
300306
[any-db-postgres]: https://github.com/grncdr/node-any-db-postgres
301307
[any-db-sqlite3]: https://github.com/grncdr/node-any-db-sqlite3
302-
[createConnection]: https://github.com/grncdr/node-any-db#exportscreateconnection
303-
304-
[Readable]: http://nodejs.org/api/stream.html#stream_class_stream_readable
305-
[Readable.pipe]: http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options
306-
307-
[ConnectionPool.query]: https://github.com/grncdr/node-any-db-pool#connectionpoolquery
308-
[ConnectionPool.acquire]: https://github.com/grncdr/node-any-db-pool#connectionpoolacquire
309-
[ConnectionPool]: https://github.com/grncdr/node-any-db-pool#api
310-
[Transaction]: https://github.com/grncdr/node-any-db-transaction#api
308+
[createconnection]: https://github.com/grncdr/node-any-db#exportscreateconnection
309+
[readable]: http://nodejs.org/api/stream.html#stream_class_stream_readable
310+
[readable.pipe]: http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options
311+
[connectionpool.query]: https://github.com/grncdr/node-any-db-pool#connectionpoolquery
312+
[connectionpool.acquire]: https://github.com/grncdr/node-any-db-pool#connectionpoolacquire
313+
[connectionpool]: https://github.com/grncdr/node-any-db-pool#api
314+
[transaction]: https://github.com/grncdr/node-any-db-transaction#api
311315
[any-db-transaction]: https://github.com/grncdr/node-any-db-transaction
312-
[Transaction.query]: https://github.com/grncdr/node-any-db-transaction#transactionquery
313-
316+
[transaction.query]: https://github.com/grncdr/node-any-db-transaction#transactionquery
314317
[test suite]: tests
315-
[Adapter]: #adapter
316-
[Queryable]: #queryable
317-
[Queryable.query]: #queryablequery
318-
[Connection]: #connection
319-
[Connection.query]: #connectionquery
320-
[Query]: #query
321-
[Adapter.createQuery]: #adaptercreatequery
318+
[adapter]: #adapter
319+
[queryable]: #queryable
320+
[queryable.query]: #queryablequery
321+
[connection]: #connection
322+
[connection.query]: #connectionquery
323+
[query]: #query
324+
[adapter.createquery]: #adaptercreatequery

packages/any-db-adapter-spec/config.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ var cc = require('config-chain')
55
var argv = require('optimist').argv
66
var parseDbUrl = require('parse-db-url')
77

8-
var config = cc(camelize(argv),
9-
camelize(cc.env('any_db_test_')),
10-
{ adapterPath: process.cwd() })
8+
var config = cc(camelize(argv), camelize(cc.env('any_db_test_')), { adapterPath: process.cwd() })
119

1210
var adapterPath = path.resolve(config.get('adapterPath'))
1311
config.set('adapterPath', adapterPath)
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
2-
exports.testProperties = function (adapter, assert) {
1+
exports.testProperties = function(adapter, assert) {
32
assert.equal(typeof adapter.name, 'string', 'adapter.name is a string')
4-
assert.equal(typeof adapter.createConnection, 'function', 'adapter.createConnection is a function')
3+
assert.equal(
4+
typeof adapter.createConnection,
5+
'function',
6+
'adapter.createConnection is a function',
7+
)
58
assert.equal(typeof adapter.createQuery, 'function', 'adapter.createQuery is a function')
69
}

packages/any-db-adapter-spec/interfaces/connection.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
var Queryable = require('./queryable')
22

3-
exports.testProperties = function (connection, adapter, assert) {
3+
exports.testProperties = function(connection, adapter, assert) {
44
Queryable.testProperties(connection, adapter, assert, 'connection')
55
assert.equal(typeof connection.end, 'function')
66
}
77

8-
exports.testEvents = function (connection, assert) {
9-
connection.on('open', function () {
8+
exports.testEvents = function(connection, assert) {
9+
connection.on('open', function() {
1010
assert.ok(1, 'connection.emit("open")')
1111
Queryable.testEvents(connection, assert, 'connection')
1212
})
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
exports.Adapter = require('./adapter')
2-
exports.Query = require('./query')
3-
exports.Queryable = require('./queryable')
1+
exports.Adapter = require('./adapter')
2+
exports.Query = require('./query')
3+
exports.Queryable = require('./queryable')
44
exports.Connection = require('./connection')
5-
exports.ResultSet = require('./result-set')
5+
exports.ResultSet = require('./result-set')
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
var EventEmitter = require('events').EventEmitter
22

3-
exports.testProperties = function (query, assert) {
4-
assert.ok(query instanceof EventEmitter, "query is an EventEmitter")
5-
assert.equal(typeof query.text, 'string', 'query.text is a string')
6-
assert.equal(typeof query.values, 'object', 'query.values is an object')
7-
assert.equal(typeof query.pause, 'function', 'query.pause is a function')
3+
exports.testProperties = function(query, assert) {
4+
assert.ok(query instanceof EventEmitter, 'query is an EventEmitter')
5+
assert.equal(typeof query.text, 'string', 'query.text is a string')
6+
assert.equal(typeof query.values, 'object', 'query.values is an object')
7+
assert.equal(typeof query.pause, 'function', 'query.pause is a function')
88
assert.equal(typeof query.resume, 'function', 'query.resume is a function')
9-
if (query.callback) assert.equal(typeof query.callback, 'function',
10-
'query.callback is a function')
9+
if (query.callback)
10+
assert.equal(typeof query.callback, 'function', 'query.callback is a function')
1111
}

0 commit comments

Comments
 (0)