Phi Docs
Select a guide from the sidebar or choose a topic below to get started.
Introduction
Overview, architecture, and design philosophy of the Phi Go ORM framework.
Quickstart
Install the Phi CLI, create a project, define a schema, migrate, and generate the type-safe Go ORM client.
Schema Walkthrough
Prisma schema definitions, supported scalar/native types, and dialect mapping rules in Phi.
Client Lifecycle
Connection pooling, statement caching, extension registration, and graceful shutdown in Phi.
Current Limitations
Known boundaries and architectural scope of Phi.
Init Command
Initialize project configuration files (phi.yml / phi.json) using the Phi CLI.
Client Generation
Generate strongly-typed Go client code from schema.prisma using the phi generate command.
Migrations
Declarative, forward-only migration workflows and Goose-compatible DDL file generation in Phi.
Create Records
Create one or more records.
Read Records
Query records using FindUnique, FindFirst, and FindMany.
Update Records
Update one or more records using type-safe update builders.
Delete Records
Delete one or more records using type-safe delete builders.
Upsert Records
Configure conflict handling for create operations.
Count Records
Count the number of records matching a set of predicates.
Select
Select specific fields and relations to return from a query.
Omit
Omit specific scalar fields from a query result.
Query Filters
The predicate system for filtering records with EQ, NEQ, GT, LT, In, Contains, Like, and logical operators.
Create Hooks
Intercept and mutate record creation with extension hooks.
Read Hooks
Intercept and mutate read queries with extension hooks.
Update Hooks
Intercept and mutate record updates with extension hooks.
Delete Hooks
Intercept and mutate record deletion with extension hooks.
Take
Limit the number of records returned by a query. Mirrors SQL's LIMIT.
Skip
Skip a number of matching records before returning results. Mirrors SQL's OFFSET.
Order By
Sort query results using Asc or Desc on any scalar field. Mirrors SQL's ORDER BY.
Cursor
Fetch pages of results relative to a known record, identified by a unique predicate.
Enums
Define, query, migrate, and enforce type-safe enum values across PostgreSQL and SQLite.
Composite Keys
Working with multi-column primary keys (@@id) and compound unique constraints (@@unique).
Transactions
Closure-based transactions, automatic rollback, panic recovery, and manual transaction control.
Raw SQL
Accessing standard database/sql handles for custom queries and vendor commands.
Error Handling
Sentinel errors, driver error translation, constraint inspection, and client-side validation rules in Phi.