Installation
npx @insforge/cli secrets get ANON_KEY, or in the dashboard: click Install and open API Keys.
insert()
Insert new records into a table.Parameters
values(object | Array, required) - Data to insert. Single object or array for bulk insertoptions.count(‘exact’ | ‘planned’ | ‘estimated’, optional) - Include count of inserted rows
Returns
Chain
.select() after .insert() to return the inserted dataExamples
Output Example
update()
Update existing records in a table. Must use filters to target specific rows.Parameters
values(object, required) - Fields to updateoptions.count(‘exact’ | ‘planned’ | ‘estimated’, optional) - Include count of updated rows
Returns
Examples
Output Example
delete()
Delete records from a table. Must use filters to target specific rows.Parameters
options.count(‘exact’ | ‘planned’ | ‘estimated’, optional) - Include count of deleted rows
Returns
Examples
Output Example
select()
Query records from a table or view.Parameters
columns(string, optional) - Comma-separated column names. Use*for all columnsoptions.count(‘exact’ | ‘planned’ | ‘estimated’, optional) - Include total row countoptions.head(boolean, optional) - Return only count, no data
Returns
Examples
Output Example
rpc()
Call PostgreSQL stored functions (RPC - Remote Procedure Call).Parameters
functionName(string, required) - Name of the PostgreSQL function to callargs(object, optional) - Arguments to pass to the function
Returns
Examples
Filters
Chain filters to narrow down query results. All filters take(column, value) as parameters.
Modifiers
Control how query results are returned.Common Patterns
Pagination with Count
Filtered Search
Using with Authentication Hooks
Combine database queries withuseUser() or useAuth() hooks to fetch user-specific data:
- Use
user.idto filter data for the authenticated user - Check
isLoadedbefore accessinguserto avoid race conditions - Check
!userto handle unauthenticated state