Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zth committed May 15, 2024
1 parent 3962287 commit f11f32a
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions RESCRIPT.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ Optionally, you can write SQL directly in your ReScript code and have a seamless

```rescript
let query = %sql.one(`
SELECT * FROM books WHERE id = :id!;
SELECT * FROM books WHERE id = :id!
`)
let res = await client->query({id: 1})
Console.log(res)
```

Notice that with the `%sql` tags, **there's no requirment to name your queries**. You can still name them if you want, but you don't have to.
Notice that with the `%sql` tags, **there's no requirement to name your queries**. You can still name them if you want, but you don't have to.

In order for this mode to work, you need one more thing - configure the `rescript-embed-lang` PPX in `rescript.json`:

Expand All @@ -119,20 +119,3 @@ The package comes with minimal bindings to be able to set up a `pg` client. Plea
await client->end
```

## Future

Here are a few loose thoughts around what we could do to improve things even more.

### SQL-in-ReScript version

Co-locate SQL directly in ReScript files. This could look something like:

```rescript
let findBookById = %sql.one(`
/* @name findBookById */
SELECT * FROM books WHERE id = :id!;
`)
let res = await client->findBookById({id: 1})
```

0 comments on commit f11f32a

Please sign in to comment.