PHI

Phi Docs

Select a guide from the sidebar or choose a topic below to get started.

Overview

Introduction

Overview, architecture, and design philosophy of the Phi Go ORM framework.

Read guide
Overview

Quickstart

Install the Phi CLI, create a project, define a schema, migrate, and generate the type-safe Go ORM client.

Read guide
Overview

Schema Walkthrough

Prisma schema definitions, supported scalar/native types, and dialect mapping rules in Phi.

Read guide
Overview

Client Lifecycle

Connection pooling, statement caching, extension registration, and graceful shutdown in Phi.

Read guide
Overview

Current Limitations

Known boundaries and architectural scope of Phi.

Read guide
CLI

Init Command

Initialize project configuration files (phi.yml / phi.json) using the Phi CLI.

Read guide
CLI

Client Generation

Generate strongly-typed Go client code from schema.prisma using the phi generate command.

Read guide
CLI

Migrations

Declarative, forward-only migration workflows and Goose-compatible DDL file generation in Phi.

Read guide
CRUD

Create Records

Create one or more records.

Read guide
CRUD

Read Records

Query records using FindUnique, FindFirst, and FindMany.

Read guide
CRUD

Update Records

Update one or more records using type-safe update builders.

Read guide
CRUD

Delete Records

Delete one or more records using type-safe delete builders.

Read guide
CRUD

Upsert Records

Configure conflict handling for create operations.

Read guide
CRUD

Count Records

Count the number of records matching a set of predicates.

Read guide
CRUD

Select

Select specific fields and relations to return from a query.

Read guide
CRUD

Omit

Omit specific scalar fields from a query result.

Read guide
CRUD

Query Filters

The predicate system for filtering records with EQ, NEQ, GT, LT, In, Contains, Like, and logical operators.

Read guide
Hooks

Create Hooks

Intercept and mutate record creation with extension hooks.

Read guide
Hooks

Read Hooks

Intercept and mutate read queries with extension hooks.

Read guide
Hooks

Update Hooks

Intercept and mutate record updates with extension hooks.

Read guide
Hooks

Delete Hooks

Intercept and mutate record deletion with extension hooks.

Read guide
Pagination & Sort

Take

Limit the number of records returned by a query. Mirrors SQL's LIMIT.

Read guide
Pagination & Sort

Skip

Skip a number of matching records before returning results. Mirrors SQL's OFFSET.

Read guide
Pagination & Sort

Order By

Sort query results using Asc or Desc on any scalar field. Mirrors SQL's ORDER BY.

Read guide
Pagination & Sort

Cursor

Fetch pages of results relative to a known record, identified by a unique predicate.

Read guide
Operations & Types

Enums

Define, query, migrate, and enforce type-safe enum values across PostgreSQL and SQLite.

Read guide
Operations & Types

Composite Keys

Working with multi-column primary keys (@@id) and compound unique constraints (@@unique).

Read guide
Operations & Types

Transactions

Closure-based transactions, automatic rollback, panic recovery, and manual transaction control.

Read guide
Operations & Types

Raw SQL

Accessing standard database/sql handles for custom queries and vendor commands.

Read guide
Operations & Types

Error Handling

Sentinel errors, driver error translation, constraint inspection, and client-side validation rules in Phi.

Read guide