Skip to content

Commit

Permalink
docs: 📝 update main readme with LimitedSelect information
Browse files Browse the repository at this point in the history
  • Loading branch information
CRBroughton committed May 11, 2024
1 parent 04358df commit dabcc8b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ functions:
- `Create` - Creates and returns a new entry into your selected table
- `Insert` - Allows you to provide an array of insertable entries into your selected table
- `Select` - Returns a type-safe array of entries from the selected table
- `LimitedSelect` - Returns a type-safe, limited array of entries from
the selected table
- `All` - Returns all entries from the selected table
- `Update` Updates and returns a single entry from the selected table
- `Delete` - Deletes an entry from a selected table
Expand Down Expand Up @@ -182,6 +184,26 @@ selection.value = Select('firstTable', {
})
```

### Selecting limited entries from the DB

When selecting entries from the database but you want to be selective about the responses values, you can utilise the `LimitedSelect` function
to retrieve an array of type-safe entries, based from the generic interface
you have supplied to Sibyl main function (see above `tableRowType`).

The core difference here is that the `where` clause now also controls
what values you get back.

```typescript
selection.value = LimitedSelect('firstTable', {
where: {
id: 1,
name: "Craig", // can combine multiple where clauses
},
limit: 20, // limit the response from Sibyl
offset: 10, // offset the response, useful for pagination
})
```

#### OR Selection

When selecting entries from the database, the `Select` function, by
Expand Down

0 comments on commit dabcc8b

Please sign in to comment.