Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit cf69d09

Browse files
committed
Boyscout: Clean up README.md
1 parent ab2fa2a commit cf69d09

File tree

1 file changed

+9
-323
lines changed

1 file changed

+9
-323
lines changed

README.md

Lines changed: 9 additions & 323 deletions
Original file line numberDiff line numberDiff line change
@@ -2,328 +2,20 @@
22

33
Isomorphic JavaScript client for [PostgREST](https://postgrest.org). The goal of this library is to make an "ORM-like" restful interface.
44

5-
**Contents**
6-
- [Usage](#usage)
7-
- [Install](#install)
8-
- [Initialize](#initialize)
9-
- [GET](#get)
10-
- [POST](#post)
11-
- [PATCH](#patch)
12-
- [DELETE](#delete)
13-
- [Usage online](#usage-online)
14-
- [Contributing](#contributing)
15-
- [License](#license)
16-
- [Credits](#credits)
17-
- [Status](#status)
18-
19-
20-
## Usage
21-
22-
### Install
23-
24-
```sh
25-
npm install --save @supabase/postgrest-js
26-
```
27-
28-
### Initialize
29-
30-
```js
31-
import { PostgrestClient } from ' @supabase/postgrest-js'
32-
let client = new PostgrestClient('https://your-postgrest.com')
33-
```
34-
35-
#### PostgrestClient(postgrestURL, OPTIONS)
36-
`postgrestURL: string`
37-
38-
The URL from where your postgREST queries.
39-
40-
`OPTIONS: object?`
41-
```js
42-
/**
43-
* @param {object?} headers
44-
* List of headers as keys and their corresponding values
45-
*
46-
* @param {object?} query_params
47-
* List of query parameters as keys and their corresponding values
48-
*
49-
* @param {string} schema
50-
* If you are using postgREST version v7.0.0 and above,
51-
* you can use this to indicate your selected schema.
52-
* This is provided that your schema is included in db-schema
53-
*/
54-
```
55-
To know more about multi schema and swithching between schema, more information can be found [here](http://postgrest.org/en/v7.0.0/configuration.html#db-schema).
56-
57-
### GET
58-
These filters also support our `PATCH` and `DELETE` actions as well. More information on our filters can be found [here](https://supabase.io/docs/library/get#filter_).
59-
60-
```js
61-
62-
// Basic
63-
let { body: countries } = await client
64-
.from('countries')
65-
.select('*')
66-
67-
// Getting specific columns
68-
let { body: countries } = await client
69-
.from('countries')
70-
.select('name')
71-
72-
// Query foreign tables
73-
let { body: countries } = await client
74-
.from('countries')
75-
.select(`
76-
name,
77-
cities (
78-
name
79-
)
80-
`)
81-
82-
// Filter foreign tables
83-
let { body: countries } = await client
84-
.from('countries')
85-
.select(`
86-
name,
87-
cities (
88-
name
89-
)
90-
`)
91-
.filter('name', 'eq', 'New Zealand')
92-
.filter('cities.name', 'eq', 'Auckland')
93-
94-
// Not (the reverse of .filter())
95-
let { body: countries } = await client
96-
.from('countries')
97-
.select(`
98-
name,
99-
cities (
100-
name
101-
)
102-
`)
103-
.not('name', 'eq', 'New Zealand')
104-
.not('cities.name', 'eq', 'Auckland')
105-
106-
// Ordering
107-
let { body: countries } = await client
108-
.from('countries')
109-
.select('name')
110-
.order('name')
111-
112-
// Ordering for foreign tables
113-
let { body: countries } = await client
114-
.from('countries')
115-
.select(`
116-
name,
117-
cities (
118-
name
119-
)
120-
`)
121-
.order('cities.name')
122-
123-
// Limiting
124-
let { body: countries } = await client
125-
.from('countries')
126-
.select('*')
127-
.limit(1)
128-
129-
// Limiting for foreign tables
130-
let { body: countries } = await client
131-
.from('countries')
132-
.select(`
133-
name,
134-
cities (
135-
name
136-
)
137-
`)
138-
.limit(1, 'cities')
139-
140-
// Setting offsets
141-
let { body: countries } = await client
142-
.from('countries')
143-
.select('*')
144-
.offset(1)
145-
146-
// Setting offsets for foreign tables
147-
let { body: countries } = await client
148-
.from('countries')
149-
.select(`
150-
name,
151-
cities (
152-
name
153-
)
154-
`)
155-
.offset(1, 'cities')
156-
157-
// Pagination
158-
let { body: countries } = await client
159-
.from('countries')
160-
.select('name')
161-
.range(0, 10)
162-
163-
// Match
164-
let { body: countries } = await client
165-
.from('countries')
166-
.match({ 'continent': 'Asia' })
167-
.select('*')
168-
169-
// Equal
170-
let { body: countries } = await client
171-
.from('countries')
172-
.eq('name', 'New Zealand')
173-
.select('*')
174-
175-
// Greater than
176-
let { body: countries } = await client
177-
.from('countries')
178-
.gt('id', 20)
179-
.select('*')
180-
181-
// Less than
182-
let { body: countries } = await client
183-
.from('countries')
184-
.lt('id', 20)
185-
.select('*')
186-
187-
// Greater than or equal
188-
let { body: countries } = await client
189-
.from('countries')
190-
.gte('id', 20)
191-
.select('*')
192-
193-
// Less than or equal
194-
let { body: countries } = await client
195-
.from('countries')
196-
.lte('id', 20)
197-
.select('*')
198-
199-
// String search - case sensitive
200-
let { body: countries } = await client
201-
.from('countries')
202-
.like('name', '%Zeal%')
203-
.select('*')
204-
205-
// String search - case insensitive
206-
let { body: countries } = await client
207-
.from('countries')
208-
.ilike('name', '%Zeal%')
209-
.select('*')
210-
211-
// Exact equality (null, true, false)
212-
let { body: countries } = await client
213-
.from('countries')
214-
.is('name', null)
215-
.select('*')
216-
217-
// In list
218-
let { body: countries } = await client
219-
.from('countries')
220-
.in('name', ['China', 'France'])
221-
.select('*')
222-
223-
// Not equal
224-
let { body: countries } = await client
225-
.from('countries')
226-
.neq('name', 'China')
227-
.select('*')
228-
229-
// Contains
230-
let { body: countries } = await client
231-
.from('countries')
232-
.cs('main_exports', ['oil'])
233-
.select('*')
234-
235-
// Contained in
236-
let { body: countries } = await client
237-
.from('countries')
238-
.cd('main_exports', ['cars', 'food', 'machine'])
239-
.select('*')
240-
241-
// Overlaps (for arrays)
242-
let { body: countries } = await client
243-
.from('countries')
244-
.ova('main_exports', ['computers', 'minerals'])
245-
.select('*')
246-
247-
// Overlaps (for ranges)
248-
let { body: countries } = await client
249-
.from('countries')
250-
.ovr('population_range_millions', [150, 250])
251-
.select('*')
252-
253-
// Strictly left
254-
let { body: countries } = await client
255-
.from('countries')
256-
.sl('population_range_millions', [150, 250])
257-
.select('*')
258-
259-
// Strictly right
260-
let { body: countries } = await client
261-
.from('countries')
262-
.sr('population_range_millions', [150, 250])
263-
.select('*')
264-
265-
// Does not extend to the left
266-
let { body: countries } = await client
267-
.from('countries')
268-
.nxl('population_range_millions', [150, 250])
269-
.select('*')
270-
271-
// Does not extend to the right
272-
let { body: countries } = await client
273-
.from('countries')
274-
.nxr('population_range_millions', [150, 250])
275-
.select('*')
276-
277-
// Adjacent
278-
let { body: countries } = await client
279-
.from('countries')
280-
.adj('population_range_millions', [70, 185])
281-
.select('*')
282-
283-
```
284-
285-
286-
### POST
287-
288-
You can insert records using `insert()`. Insert accepts an array of objects so that you can batch insert.
289-
290-
```js
291-
let { status } = await client
292-
.from('messages')
293-
.insert([{ message: 'Hello World 👋'])
294-
```
295-
296-
### PATCH
297-
298-
You can update records using `update()`.
299-
300-
```js
301-
let { status } = await client
302-
.from('messages')
303-
.eq('message', 'Hello World 👋')
304-
.update({ message: 'Goodbye World 👋' })
305-
```
5+
## Status
3066

307-
### DELETE
7+
![Tests](https://github.com/supabase/postgrest-js/workflows/Node.js%20CI/badge.svg)
3088

309-
You can delete records using `delete()`.
9+
Ready for production! Watch and star this repo to keep updated on releases.
31010

311-
```js
312-
let { status } = await client
313-
.from('messages')
314-
.eq('message', 'Goodbye World 👋')
315-
.delete()
316-
```
11+
## Documentation
12+
Visit our [wiki](https://github.com/supabase/postgrest-js/wiki) to get started!
31713

31814
## Usage online
31915

320-
To see details examples of usage, see the Supabase docs:
321-
322-
- [Reading](https://supabase.io/docs/library/get)
323-
- [Creating](https://supabase.io/docs/library/post)
324-
- [Creating](https://supabase.io/docs/library/post)
325-
- [Deleting](https://supabase.io/docs/library/delete)
326-
- [Stored Procedures](https://supabase.io/docs/library/stored-procedures)
16+
### supabase/supabase-js
17+
- [Repository](https://github.com/supabase/supabase-js)
18+
- [Documentation](https://supabase.io/docs/about)
32719

32820
## Contributing
32921

@@ -349,10 +41,4 @@ This repo is liscenced under MIT.
34941

35042
- https://github.com/calebmer/postgrest-client - originally forked and adapted from @calebmer's library
35143

352-
## Status
353-
354-
![Tests](https://github.com/supabase/postgrest-js/workflows/Node.js%20CI/badge.svg)
355-
356-
Ready for production! Watch and star this repo to keep updated on releases.
357-
358-
![Watch this repo](https://gitcdn.xyz/repo/supabase/monorepo/master/web/static/watch-repo.gif "Watch this repo")
44+
![Watch this repo](https://gitcdn.xyz/repo/supabase/monorepo/master/web/static/watch-repo.gif "Watch this repo")

0 commit comments

Comments
 (0)