Skip to main content

Installation

Add InsForge to your Swift Package Manager dependencies:

Enable Logging (Optional)

For debugging, you can configure the SDK log level and destination:
Log Levels: Log Destinations:
Use .info or .error in production to avoid exposing sensitive data in logs.

Define Models

Define your data models using Swift’s Codable protocol:

insert()

Insert new records into a table.

Parameters

  • values - Single Codable object or array of objects to insert

Examples


update()

Update existing records in a table.

Examples


delete()

Delete records from a table.

Examples


select()

Query records from a table.

Examples


rpc()

Call PostgreSQL stored functions (RPC - Remote Procedure Call). This method allows you to directly invoke SQL functions defined in your database.

Parameters

  • functionName (String) - Name of the PostgreSQL function to call
  • args ([String: Any]?, optional) - Arguments to pass to the function

Examples

Implementation Details

  • No arguments: Uses GET request to /api/database/rpc/{functionName}
  • With arguments: Uses POST request with JSON body to /api/database/rpc/{functionName}
  • Use execute() for functions returning arrays or void
  • Use executeSingle() for functions returning a single object or value

Filters


Modifiers