Documentation
¶
Overview ¶
Package frame documents the service infrastructure library. Applications import the capability packages they use and compose them explicitly.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package app manages a service and its dependencies with ordered startup, rollback, graceful shutdown and reverse-order cleanup.
|
Package app manages a service and its dependencies with ordered startup, rollback, graceful shutdown and reverse-order cleanup. |
|
command
Package command dispatches standard service commands without opening resources, changing globals, installing signal handlers or exiting the process.
|
Package command dispatches standard service commands without opening resources, changing globals, installing signal handlers or exiting the process. |
|
config
Package config supplies independently composable deployment settings without opening resources.
|
Package config supplies independently composable deployment settings without opening resources. |
|
config/redis
Package redis maps configuration to Redis options, including verified TLS.
|
Package redis maps configuration to Redis options, including verified TLS. |
|
resource
Package resource adapts explicitly owned dependencies to app lifecycle hooks.
|
Package resource adapts explicitly owned dependencies to app lifecycle hooks. |
|
startup
Package startup owns process loading diagnostics and the optional logger runtime.
|
Package startup owns process loading diagnostics and the optional logger runtime. |
|
auth
|
|
|
http
Package auth adapts credential verification to HTTP with default-required routes.
|
Package auth adapts credential verification to HTTP with default-required routes. |
|
principal
Package principal carries validated application identity, not credentials or permissions.
|
Package principal carries validated application identity, not credentials or permissions. |
|
token
Package token issues and verifies one deliberately narrow encrypted access-token profile: ES256 signed JWT inside a dir/A256GCM compact JWE.
|
Package token issues and verifies one deliberately narrow encrypted access-token profile: ES256 signed JWT inside a dir/A256GCM compact JWE. |
|
Package cache defines bounded byte stores and explicit JSON serialization helpers.
|
Package cache defines bounded byte stores and explicit JSON serialization helpers. |
|
memory
Package memory provides a bounded process-local LRU cache with lazy expiry.
|
Package memory provides a bounded process-local LRU cache with lazy expiry. |
|
redis
Package redis implements cache.Store using a borrowed Redis client.
|
Package redis implements cache.Store using a borrowed Redis client. |
|
cmd
|
|
|
frame
command
Command frame runs local development tooling; see `frame dev`.
|
Command frame runs local development tooling; see `frame dev`. |
|
Package concurrency provides bounded, per-process concurrency primitives.
|
Package concurrency provides bounded, per-process concurrency primitives. |
|
Package config decodes explicitly declared configuration schemas, merges sources and reports safe field diagnostics independently of deployment models.
|
Package config decodes explicitly declared configuration schemas, merges sources and reports safe field diagnostics independently of deployment models. |
|
dotenv
Package dotenv parses explicit development-only environment files without changing the process environment.
|
Package dotenv parses explicit development-only environment files without changing the process environment. |
|
loader
Package loader composes explicit YAML, development dotenv, captured environment and CLI inputs.
|
Package loader composes explicit YAML, development dotenv, captured environment and CLI inputs. |
|
reload
Package reload provides isolated configuration snapshots and explicit-file watching.
|
Package reload provides isolated configuration snapshots and explicit-file watching. |
|
yaml
Package yaml supplies a strict, bounded, optional YAML configuration source.
|
Package yaml supplies a strict, bounded, optional YAML configuration source. |
|
Package database provides a driver-independent SQL connection pool.
|
Package database provides a driver-independent SQL connection pool. |
|
audit
Package audit defines explicit creation and update metadata, independent of authentication, persistence, clocks, and transaction policy.
|
Package audit defines explicit creation and update metadata, independent of authentication, persistence, clocks, and transaction policy. |
|
audit/principal
Package principal converts trusted request identities to explicit audit actors.
|
Package principal converts trusted request identities to explicit audit actors. |
|
ent
Package entdb integrates business-owned Ent clients with Frame infrastructure.
|
Package entdb integrates business-owned Ent clients with Frame infrastructure. |
|
internal/txcleanup
Package txcleanup shares SQL and Ent transaction cleanup error policy.
|
Package txcleanup shares SQL and Ent transaction cleanup error policy. |
|
mysql
Package mysql constructs a lazy MySQL pool using go-sql-driver/mysql.
|
Package mysql constructs a lazy MySQL pool using go-sql-driver/mysql. |
|
postgres
Package postgres constructs a lazy PostgreSQL pool using pgx's SQL adapter.
|
Package postgres constructs a lazy PostgreSQL pool using pgx's SQL adapter. |
|
query
Package query builds bounded SQL pagination suffixes without executing or rewriting queries.
|
Package query builds bounded SQL pagination suffixes without executing or rewriting queries. |
|
examples
|
|
|
authenticated
Package authenticated demonstrates explicit auth, operation and audit wiring.
|
Package authenticated demonstrates explicit auth, operation and audit wiring. |
|
background
Package background illustrates consumer-owned queues and task registration.
|
Package background illustrates consumer-owned queues and task registration. |
|
basic
command
The example starts without a database or Redis.
|
The example starts without a database or Redis. |
|
basic/internal/greeting
Package greeting shows a feature module with an explicitly injected service.
|
Package greeting shows a feature module with an explicitly injected service. |
|
business/cmd/api
command
Command api runs the category business example.
|
Command api runs the category business example. |
|
business/internal/bootstrap
Package bootstrap owns configuration and explicit assembly for the category service.
|
Package bootstrap owns configuration and explicit assembly for the category service. |
|
business/internal/category
Package category owns category rules independently of HTTP and persistence.
|
Package category owns category rules independently of HTTP and persistence. |
|
business/internal/category/http
Package categoryhttp adapts the category feature to Frame's HTTP boundary.
|
Package categoryhttp adapts the category feature to Frame's HTTP boundary. |
|
business/internal/category/store
Package store persists business category snapshots with native Ent queries.
|
Package store persists business category snapshots with native Ent queries. |
|
business/internal/devicesync
Package devicesync demonstrates durable acceptance and replayable delivery.
|
Package devicesync demonstrates durable acceptance and replayable delivery. |
|
business/internal/devicesync/store
Package store implements device event state using an application-owned PostgreSQL schema.
|
Package store implements device event state using an application-owned PostgreSQL schema. |
|
business/internal/devicesync/worker
Package worker demonstrates bounded, process-local delivery scheduling.
|
Package worker demonstrates bounded, process-local delivery scheduling. |
|
business/internal/profile
Package profile defines a profile update use case without transport or storage dependencies.
|
Package profile defines a profile update use case without transport or storage dependencies. |
|
business/internal/profile/http
Package profilehttp maps authenticated HTTP requests to the profile use case.
|
Package profilehttp maps authenticated HTTP requests to the profile use case. |
|
business/internal/profile/store
Package store persists profiles and change records in one PostgreSQL transaction.
|
Package store persists profiles and change records in one PostgreSQL transaction. |
|
business/internal/profile/upstream
Package upstream implements the typed profile permission dependency.
|
Package upstream implements the typed profile permission dependency. |
|
configured
command
Configured demonstrates business-owned settings and resource-free commands.
|
Configured demonstrates business-owned settings and resource-free commands. |
|
contracts/endpoint
Package endpoint compares typed registration helpers in examples only.
|
Package endpoint compares typed registration helpers in examples only. |
|
contracts/transactionhttp
Package transactionhttp is an example-only comparison of explicit and typed route composition for an independent transaction pagination contract.
|
Package transactionhttp is an example-only comparison of explicit and typed route composition for an independent transaction pagination contract. |
|
ent
command
Apply the selected versioned migration before running.
|
Apply the selected versioned migration before running. |
|
ent/internal/productvalue
Package productvalue contains field-independent rules shared by DTOs and Ent.
|
Package productvalue contains field-independent rules shared by DTOs and Ent. |
|
observability
command
Observability demonstrates explicit SDK ownership without an external collector.
|
Observability demonstrates explicit SDK ownership without an external collector. |
|
protocols
Package protocols demonstrates protocol adapters with business-owned effects.
|
Package protocols demonstrates protocol adapters with business-owned effects. |
|
records
command
Records demonstrates explicit HTTP -> service -> SQL composition.
|
Records demonstrates explicit HTTP -> service -> SQL composition. |
|
records/internal/record
Package record owns the feature's business rules and persistence contracts.
|
Package record owns the feature's business rules and persistence contracts. |
|
records/internal/sqlstore
Package sqlstore implements the record service's persistence contracts.
|
Package sqlstore implements the record service's persistence contracts. |
|
toolkit
Package toolkit illustrates direct assembly of cross-cutting foundations: bounded caching, Redis lease locks, admission limiting, process-local scheduling, the outbound HTTP client, and hand-rolled transport middleware.
|
Package toolkit illustrates direct assembly of cross-cutting foundations: bounded caching, Redis lease locks, admission limiting, process-local scheduling, the outbound HTTP client, and hand-rolled transport middleware. |
|
transactions
Package transactionexample demonstrates explicit business transactions and typed HTTP boundaries.
|
Package transactionexample demonstrates explicit business transactions and typed HTTP boundaries. |
|
Package health provides liveness and bounded, named readiness checks.
|
Package health provides liveness and bounded, named readiness checks. |
|
http
|
|
|
binding
Package binding composes prepared DTO decoding, validation and typed handlers.
|
Package binding composes prepared DTO decoding, validation and typed handlers. |
|
client
Package httpclient provides an owned outbound transport and bounded JSON calls.
|
Package httpclient provides an owned outbound transport and bounded JSON calls. |
|
health
Package healthhttp exposes readiness and liveness over HTTP.
|
Package healthhttp exposes readiness and liveness over HTTP. |
|
httperror
Package httperror defines explicit public HTTP errors shared by request and response adapters.
|
Package httperror defines explicit public HTTP errors shared by request and response adapters. |
|
middleware
Package middleware provides request logging, cooperative deadlines and bounded admission.
|
Package middleware provides request logging, cooperative deadlines and bounded admission. |
|
request
Package request binds explicit, flat query and path DTOs without a router dependency.
|
Package request binds explicit, flat query and path DTOs without a router dependency. |
|
respond
Package respond provides JSON envelopes, error handling, and explicit error mapping.
|
Package respond provides JSON envelopes, error handling, and explicit error mapping. |
|
router
Package router composes chi routes with framework middleware and health endpoints.
|
Package router composes chi routes with framework middleware and health endpoints. |
|
server
Package server provides composable chi routing and configurable HTTP servers.
|
Package server provides composable chi routing and configurable HTTP servers. |
|
Package id 分布式 ID 生成。
|
Package id 分布式 ID 生成。 |
|
Package identity supplies deployment-independent service and instance metadata.
|
Package identity supplies deployment-independent service and instance metadata. |
|
internal
|
|
|
consumer
Package consumer verifies independent consumers without changing the repository.
|
Package consumer verifies independent consumers without changing the repository. |
|
dev
Package dev implements a bounded, build-before-stop development supervisor.
|
Package dev implements a bounded, build-before-stop development supervisor. |
|
faulttest
Package faulttest provides test-only, connection-scoped fault injection.
|
Package faulttest provides test-only, connection-scoped fault injection. |
|
isnil
Package isnil reports typed nil values passed through interface arguments.
|
Package isnil reports typed nil values passed through interface arguments. |
|
requestmeta
Package requestmeta shares bounded observation state across middleware context copies.
|
Package requestmeta shares bounded observation state across middleware context copies. |
|
responsewriter
Package responsewriter observes response commitment without buffering bodies.
|
Package responsewriter observes response commitment without buffering bodies. |
|
sortspec
Package sortspec carries the sort-whitelist algorithm shared by the SQL query helpers and the Ent adapter.
|
Package sortspec carries the sort-whitelist algorithm shared by the SQL query helpers and the Ent adapter. |
|
sqltest
Package sqltest contains opt-in database integration assertions for adapters.
|
Package sqltest contains opt-in database integration assertions for adapters. |
|
lock
|
|
|
redis
Package redis provides cooperative leases using a borrowed Redis client.
|
Package redis provides cooperative leases using a borrowed Redis client. |
|
Package optional provides presence-aware JSON request fields.
|
Package optional provides presence-aware JSON request fields. |
|
Package pagination defines protocol-independent, bounded offset pagination.
|
Package pagination defines protocol-independent, bounded offset pagination. |
|
Package redis provides an explicitly configured Redis connection pool.
|
Package redis provides an explicitly configured Redis connection pool. |
|
Package schedule runs explicitly registered, process-local recurring tasks.
|
Package schedule runs explicitly registered, process-local recurring tasks. |
|
scripts
|
|
|
consumer
command
Command consumer verifies independent Frame consumer modules.
|
Command consumer verifies independent Frame consumer modules. |
|
release-check
command
Command release-check validates local release version declarations and, optionally, checks that the VERSION tag resolves to HEAD.
|
Command release-check validates local release version declarations and, optionally, checks that the VERSION tag resolves to HEAD. |
|
verify-test
command
Command verify-test supplies the shared test stage of the verification scripts.
|
Command verify-test supplies the shared test stage of the verification scripts. |
|
telemetry
|
|
|
logger
Package logger slog 接线:console/JSON 输出 + ctx 惯用法 + 文件轮转。
|
Package logger slog 接线:console/JSON 输出 + ctx 惯用法 + 文件轮转。 |
|
metric
Package metric provides fixed-bucket request-latency histograms with dependency-free exports.
|
Package metric provides fixed-bucket request-latency histograms with dependency-free exports. |
|
metric/otel
Package metricotel binds a metric.RequestRecorder to OpenTelemetry histograms.
|
Package metricotel binds a metric.RequestRecorder to OpenTelemetry histograms. |
|
metric/redis
Package metricredis adapts Redis client pool statistics without network I/O.
|
Package metricredis adapts Redis client pool statistics without network I/O. |
|
operation
Package operation defines bounded, structured operation events and sinks.
|
Package operation defines bounded, structured operation events and sinks. |
|
operation/http
Package operationhttp records bounded HTTP operations with route-controlled request capture.
|
Package operationhttp records bounded HTTP operations with route-controlled request capture. |
|
otel
Package telemetry adapts explicit OpenTelemetry providers to HTTP and slog.
|
Package telemetry adapts explicit OpenTelemetry providers to HTTP and slog. |
|
trace
Package trace provides request correlation IDs, response headers and context propagation.
|
Package trace provides request correlation IDs, response headers and context propagation. |
|
Package validation defines transport-independent, public field diagnostics.
|
Package validation defines transport-independent, public field diagnostics. |
|
tags
Package tags adapts declarative v-tag validation to safe input errors.
|
Package tags adapts declarative v-tag validation to safe input errors. |
Click to show internal directories.
Click to hide internal directories.