Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 92 lines (67 sloc) 2.277 kb
91355c5 first commit
Alex Young authored
1 # select
2
3 `select` is a database library.
4
5 Supported databases:
6
7 * MySQL
8 * MongoDB
9 * Memory
10 * CouchDB (partial)
11 * Planned: PostgreSQL, SQLite
12 * Researching: Riak, Redis, selector language
13
14 ## Installation
15
16 $ npm install select
17
18 ## Examples
19
f3e5696 The examples now include a db connection string
Alex Young authored
20 // Set the database connection string
21 select.db = 'mysql://root@localhost/select-test';
22
91355c5 first commit
Alex Young authored
23 // Find some items and iterate
24 select('users')
25 .find({ name: 'Alex' })
26 .limit(3)
27 .offset(8)
28 .each(function(index) {
29 console.log(this);
30 });
31
32 // Update an attribute
33 select('users')
34 .find(17)
35 .attr({ name: 'Yuka' });
36
37 // Create
38 select('users')
39 .add({
40 name: 'Bob',
41 email: 'bob@example.com'
42 });
43
44 // Delete
45 select('users')
46 .find(1)
47 .del();
48
49 // Selector language
50 select('users[name="Alex", email="alex@example.com"]').
51 values(function(values) {});
52
53 ## Philosophy
54
55 `select` is:
56
57 * A quick way of using common database features
58 * Easy to learn for JavaScript developers
59 * Easy to extend
60
61 `select` is not:
62
63 * For building schemas
64 * An ORM
65 * A validation library
66
67 ## License
68
69 (The MIT License)
70
71 Copyright (c) 2011 Alex R. Young
72
73 Permission is hereby granted, free of charge, to any person obtaining
74 a copy of this software and associated documentation files (the
75 'Software'), to deal in the Software without restriction, including
76 without limitation the rights to use, copy, modify, merge, publish,
77 distribute, sublicense, and/or sell copies of the Software, and to
78 permit persons to whom the Software is furnished to do so, subject to
79 the following conditions:
80
81 The above copyright notice and this permission notice shall be
82 included in all copies or substantial portions of the Software.
83
84 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
85 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
86 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
87 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
88 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
89 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
90 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
91
Something went wrong with that request. Please try again.