Documentation
¶
Overview ¶
Package repo selects between concrete service.Repository / service.DB drivers (entdb, postgres, memory) for the production binary's wiring code.
Each driver lives in its own sub-package — internal/repo/entdb for the EntDB-backed driver, internal/repo/postgres for the SQL driver, internal/repo/memory for the in-process store used by tests. The split keeps each driver's dependencies isolated (entdb pulls in the SDK; postgres pulls in pgx; memory pulls in nothing).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDBAdapter ¶
NewDBAdapter exposes the SDK's raw transport as service.DB. The service.DB contract is already the transport contract: tenant id, actor, numeric type ids, field-id-keyed filters, and raw entdb.Operation batches. Going through the SDK's typed Query/Get helpers here loses node ids on query results, so the adapter must delegate to the raw transport instead of translating through typed witnesses.
Types ¶
type Built ¶
type Built struct {
Repository service.Repository
DB service.DB
}
Built bundles the constructed Repository + DB pair so callers can wire them into the service layer in one shot.
type Config ¶
type Config struct {
// Driver is the chosen backend. Required.
Driver Driver
// EntDB-specific.
EntDBClient *sdk.DbClient
TenantID string
// Postgres-specific.
PostgresDSN string
PostgresMaxConns int
PostgresAutoMigrate bool
}
Config selects which driver to build and carries the parameters each driver needs.
type Driver ¶
type Driver string
Driver names a concrete persistence backend.
const ( // DriverEntDB targets the EntDB gRPC server via the typed SDK. DriverEntDB Driver = "entdb" // DriverPostgres targets a Postgres database via pgx/v5. DriverPostgres Driver = "postgres" // DriverMemory targets a process-local in-memory store, useful // for unit tests and local development. DriverMemory Driver = "memory" )
Directories
¶
| Path | Synopsis |
|---|---|
|
Package conformance is a driver-agnostic test suite for service.Repository implementations.
|
Package conformance is a driver-agnostic test suite for service.Repository implementations. |
|
Package entdb is the EntDB-backed implementation of service.Repository.
|
Package entdb is the EntDB-backed implementation of service.Repository. |
|
Package memory is the in-process Repository driver.
|
Package memory is the in-process Repository driver. |
|
Package postgres provides a Postgres-backed implementation of service.Repository for the identity service.
|
Package postgres provides a Postgres-backed implementation of service.Repository for the identity service. |