Features¶
Reference of gerpo capabilities grouped by area.
See it all working together
examples/todo-api/ is a runnable CRUD REST service that combines most of the pages below — column bindings, RETURNING, request-scope cache, transactions via RunInTx, domain error mapping — against a real PostgreSQL with goose migrations. docker compose up --build and the API boots on :8080. Pair it with the Production-ready setup page for the narrated walkthrough.
Configuration¶
| Page | What's inside |
|---|---|
| Repository builder | New[T](), DB, Table, Build, repository lifecycle |
| Columns | Field, AsVirtual, OmitOnInsert/OmitOnUpdate/ReadOnly, aliases, columns from other tables |
| Persistent queries | WithQuery: conditions, JOINs, auto GROUP BY |
| Soft delete | Turning DELETE into UPDATE |
| Virtual columns | Computed fields at the SELECT level |
| Hooks | Before/After for Insert/Update/Select |
| Error transformer | Mapping gerpo errors to domain errors |
Operations¶
| Page | What's inside |
|---|---|
| CRUD operations | GetFirst, GetList, Count, Insert, Update, Delete |
| WHERE operators | EQ, NotEQ, LT/LTE/GT/GTE, In/NotIn, Contains/StartsWith/EndsWith (+Fold variants), AND/OR/Group |
| Ordering & pagination | OrderBy, Page, Size |
| Exclude & Only | Narrowing columns in SELECT/INSERT/UPDATE |
| Transactions | BeginTx, gerpo.WithTx(ctx, tx), gerpo.RunInTx, Commit, Rollback, RollbackUnlessCommitted |
Infrastructure¶
| Page | What's inside |
|---|---|
| Cache | Cache — cache scoped to a request context |
| Tracing | WithTracer hook — OpenTelemetry / Datadog / any tracer |
| Adapters | pgx v5, pgx v4, database/sql, and custom adapters |
| Static analysis (gerpolint) | go vet-time checker that catches EQ("18") on int fields, also ships as a golangci-lint plugin |