primitives

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2026 License: AGPL-3.0 Imports: 0 Imported by: 0

README

primitives-go

Go Reference

The tier every service is built from: providers behind interfaces, the transports whose shape somebody else decided, the database and schema tooling stores are built with, and the handful of values both tiers have to agree on. Layers that touch the network — HTTP, gRPC, database, messaging — instrument with OpenTelemetry.

Module: github.com/primandproper/primitives-go Go: 1.27

The packages arrived in one move from platform-go (primandproper/primitives-go#2), with history preserved: git log and git blame reach back through the years they spent there.

What belongs here

primitives-go ships what every service is built from and no service is. Four kinds of thing qualify: a provider behind an interface (cache, email, messagequeue, ...); a transport whose shape is decided by something other than the consumer's domain (a probe, a protocol, a middleware contract, a third party's payload); the database and schema tooling stores are built with (database and its subpackages, filtering); and the cross-cutting values both tiers have to agree on (tenancy.Scope, the errors sentinels, clock). Nothing in it owns a table.

platform-go ships what a product has: a noun with a table, its lifecycle, its transport, its permissions and its privacy obligations. The test for a new package is whether an application with no users would still need it. If yes, it is a primitive.

The dependency runs one way. platform-go imports this module; this module imports platform-go from nowhere, ever. A primitive that finds it needs a domain package has found a seam to invert, not a dependency to add — the error mappers are the worked example: each domain package exports its Mapper and platform-go's service registers it, rather than errors/http reaching for the domain.

Project Status & Stability

main is not a release channel. Anything on main that has not been cut into a tagged release is considered under active development — alpha/beta, unstable, and unsupported. Treat it as such.

This repository follows a deliberately conservative release model:

  • Only tagged releases are supported. If it isn't behind a version tag, it can change or break without notice, and no support or compatibility is promised for it.
  • main moves ahead of the latest release. New work — including breaking changes — lands on main well before it is deemed release-worthy. Two facts locate you at any moment, and both are derived rather than written down here: the module path in go.mod is the major that main is currently building toward, and the highest version tag is the latest supported release. Whatever is on main but not yet in that tag is subject to change — and immediately after a major bump, that is the entire major.
  • Semantic Versioning, enforced by Go's module paths. Breaking changes increment the major version and the module import path (/vN/vN+1), so a major bump can never silently break a consumer that hasn't opted in. The path bump lands in the same change that makes the break, never as a follow-up, which is why main's major is frequently one ahead of anything you can fetch by tag.
  • No stability guarantees on unreleased APIs. Interfaces, config shapes, and package boundaries on main are subject to change until they ship in a release.

If you depend on this library, pin to a released tag — and note that @latest against a major that has no tag yet resolves to a commit on main rather than to a release. If you want to track upcoming work, main is fair game — just don't expect it to hold still.

This module is v1, and being the slow tier it intends to stay there. That is an intention rather than a promise: the model above is the promise, and a v2 would arrive the same way any major does.

Installation

go get github.com/primandproper/primitives-go@latest

Because breaking changes ride the major-version import path, upgrading across majors is an explicit, opt-in edit to your import paths — never a surprise from go get -u.

Package Catalog

Implementations are listed in parentheses; most concerns also ship a noop. Two packages sit under a parent this module does not ship — notifications/mobile and webhooks/inbound — because the parent owns a table and stayed in platform-go. They kept their import paths rather than being renamed on the way out.

Data & storage
Package Purpose Implementations
database SQL access + instrumentation, and the schema/query tooling stores are built with postgres, mysql, sqlite; querygen, migrate, ddl, dialect, sqlguard
cache Generic key/value cache (Cache[T]) redis, memory
uploads Blob/object storage & image handling objectstorage (S3-compatible), images
files Filesystem & streaming helpers
secrets Secret sourcing (+ caching/rotation) env, gcp, ssm, kubernetes
Messaging & events
Package Purpose Implementations
messagequeue Publish/subscribe & queues kafka, pubsub, redis, sqs
eventstream Server push to clients sse, websocket
notifications/mobile Mobile push apns, fcm
email Transactional email mailgun, mailjet, postmark, resend, sendgrid, ses
Web & transport
Package Purpose Implementations
server Service servers grpc, http
routing HTTP router abstraction chi, stdlib, httprouter, gin
httpclient Instrumented HTTP client
cookies Cookie management
encoding Content encoding/decoding
compression Payload compression
ratelimiting Request rate limiting redis (+ http, grpc middleware)
circuitbreaking Circuit breaker partitioned
retry Retry with backoff
idempotency At-most-once effect for retried requests http, grpc (server + client)
webhooks/inbound Inbound webhook receipt: verify, publish, ack stripe, github, generic HMAC
Observability & operations
Package Purpose Implementations
observability Logging, tracing, metrics, profiling logging (slog, zap, zerolog); OTel tracing/metrics; pprof, pyroscope
healthcheck Health/readiness checks
version Build/version metadata
clock Injectable time
config Config loading & env parsing envvars, injection, cfgnorm
Auth & security
Package Purpose Implementations
authentication Password hashing, TOTP, tokens argon2, totp, tokens (jwt, paseto)
authentication/webauthn Passkey registration & login, with ceremony state that outlives one replica cache
authentication/oauth2server The OAuth2 / OIDC protocol surface: authorize, token, revoke, registration memory
authorization Role/permission policy, enforcement static (default), cached (+ http, grpc)
cryptography Cryptographic primitives encryption (aes, kms), hashing
cryptography/requestsigning HMAC request signing & verification v1
random Secure randomness
identifiers ID generation
AI, ML & product
Package Purpose Implementations
llm Large language model clients anthropic, openai
embeddings Embedding generation cohere, ollama, openai
search/text Text search algolia, elasticsearch
search/vector Vector search pgvector, qdrant
analytics Product analytics posthog, segment, multisource
featureflags Feature flagging launchdarkly, posthog
capitalism Payment provider adapters stripe, revenuecat
Coordination
Package Purpose Implementations
distributedlock Distributed locking memory, postgres, redis
jobs Queue workers & periodic jobs
filtering Query filters / pagination, and the proto both tiers generate from filteringpb, grpc converters
eventcapture Recording domain events jsonl
batching Batched work with size and time triggers
Utilities

errors (and errors/http, errors/grpc), tenancy, pointer, numbers, bitmask, charset, reflection, panicking, qrcodes, testutils, fake.

Development

make setup          # Install dev tools and download deps
make format         # Format all Go code (imports, field/tag alignment, gofmt)
make lint           # Run golangci-lint (Docker) + shellcheck
make test           # Run tests (race detector, shuffle, failfast)
make build          # Build all packages
make generate       # Regenerate moq mocks after changing a mocked interface
make proto format   # Regenerate the Go bindings for the .proto files this module ships
make bench          # Run benchmarks

Formatting runs locally with gci, goimports, betteralign, tagalign, and gofmt. Linting runs in Docker against the golangci/golangci-lint image (42+ linters, golangci-lint v2 format).

Testing conventions
  • stretchr/testify is banned (assert, require, and mock), enforced by depguard. Use shoenig/test for assertions (test for non-fatal, must for fatal) and matryer/moq for mocks.
  • Tests run in parallel by default and use subtests throughout.
  • Container-backed tests use testcontainers-go, live in-package (typically containers_test.go), and gate on RUN_CONTAINER_TESTS=true.
  • make test runs CGO_ENABLED=1 go test -shuffle=on -race -vet=all -failfast ./... across every package. .scripts/test.sh false runs the suite without container tests.

Contributing

Because main is a development channel and only tagged releases are supported, changes land on main freely and are stabilized before release. Follow the existing package layout (interface + config subpackage + provider implementations + noop), match the surrounding code, and keep make format lint test green.

Documentation

Overview

Package primitives is the root of the module and holds no code. It exists so that the module documents itself at its own import path, and so that `go build ./...` and `go test ./...` have one thing to be pointed at.

The packages live one directory down, each named for the concern it covers. Two sit one level deeper than that — notifications/mobile and webhooks/inbound — because the package they are nested under owns a table and stayed in platform-go. They kept the import paths they arrived with, so this module has a notifications directory and a webhooks directory that are not themselves packages.

What belongs here

This module ships what every service is built from and no service is. Four kinds of thing qualify:

  • a provider behind an interface — cache, email, messagequeue, secrets;
  • a transport whose shape is decided by something other than the consumer's domain — a probe, a protocol, a middleware contract, a third party's payload;
  • the database and schema tooling stores are built with — database and its subpackages, filtering;
  • the cross-cutting values both tiers have to agree on — tenancy.Scope, the errors sentinels, clock.

Nothing in it owns a table. A package that owns a noun with a table — its lifecycle, its transport, its permissions and its privacy obligations — is github.com/primandproper/platform-go's. The test for a new package is whether an application with no users would still need it. If yes, it is a primitive and it belongs here.

The dependency runs one way: platform-go imports this module, and this module imports platform-go from nowhere, ever.

Directories

Path Synopsis
Package analytics provides an event reporting interface for collecting and tracking customer data and events.
Package analytics provides an event reporting interface for collecting and tracking customer data and events.
config
Package analyticscfg selects and builds an analytics.EventReporter from configuration — Segment, PostHog, or the noop reporter — handing the vendor implementations a circuit breaker built from the same config.
Package analyticscfg selects and builds an analytics.EventReporter from configuration — Segment, PostHog, or the noop reporter — handing the vendor implementations a circuit breaker built from the same config.
mock
Package analyticsmock provides moq-generated mocks for the analytics package.
Package analyticsmock provides moq-generated mocks for the analytics package.
multisource
Package multisource fans analytics events out to one reporter per named source.
Package multisource fans analytics events out to one reporter per named source.
noop
Package noop is the analytics.EventReporter for a deployment that measures nothing.
Package noop is the analytics.EventReporter for a deployment that measures nothing.
posthog
Package posthog reports analytics events to PostHog.
Package posthog reports analytics events to PostHog.
segment
Package segment reports analytics events to Segment.
Package segment reports analytics events to Segment.
Package authentication holds the password engine and names the boundary the sign-in flow sits on the other side of.
Package authentication holds the password engine and names the boundary the sign-in flow sits on the other side of.
argon2
Package argon2 is the argon2id authentication.Authenticator: the password hasher this module recommends, and the only implementation of that interface it ships.
Package argon2 is the argon2id authentication.Authenticator: the password hasher this module recommends, and the only implementation of that interface it ships.
oauth2server
Package oauth2server is an OAuth 2.1 authorization server: the endpoints, the grant logic, and a Store seam underneath them.
Package oauth2server is an OAuth 2.1 authorization server: the endpoints, the grant logic, and a Store seam underneath them.
oauth2server/config
Package oauth2servercfg assembles an OAuth 2.1 authorization server, and an in-memory Store, from environment configuration.
Package oauth2servercfg assembles an OAuth 2.1 authorization server, and an in-memory Store, from environment configuration.
oauth2server/memory
Package memory keeps an authorization server's state in maps.
Package memory keeps an authorization server's state in maps.
oauth2server/oauth2servertest
Package oauth2servertest holds the behavior every oauth2server.Store owes its callers, written once and run against each implementation.
Package oauth2servertest holds the behavior every oauth2server.Store owes its callers, written once and run against each implementation.
tokens
Package tokens is the seam for bearer tokens: an Issuer mints them and parses them back, and the jwt and paseto subpackages implement it.
Package tokens is the seam for bearer tokens: an Issuer mints them and parses them back, and the jwt and paseto subpackages implement it.
tokens/config
Package tokenscfg selects and builds a tokens.Issuer from configuration: either the JWT signer or the PASETO one.
Package tokenscfg selects and builds a tokens.Issuer from configuration: either the JWT signer or the PASETO one.
tokens/jwt
Package jwt is the HS256 tokens.Issuer: JSON Web Tokens signed with a shared secret.
Package jwt is the HS256 tokens.Issuer: JSON Web Tokens signed with a shared secret.
tokens/mock
Package tokensmock provides moq-generated mock implementations of interfaces in the tokens package.
Package tokensmock provides moq-generated mock implementations of interfaces in the tokens package.
tokens/paseto
Package paseto is the PASETO v2.local tokens.Issuer: tokens whose claims are encrypted rather than merely signed.
Package paseto is the PASETO v2.local tokens.Issuer: tokens whose claims are encrypted rather than merely signed.
totp
Package totp provides a TOTP (RFC 6238) second-factor verifier.
Package totp provides a TOTP (RFC 6238) second-factor verifier.
totp/mock
Package totpmock provides moq-generated mock implementations of interfaces in the totp package.
Package totpmock provides moq-generated mock implementations of interfaces in the totp package.
webauthn
Package webauthn provides passkey registration and login over github.com/go-webauthn/webauthn, and the ceremony store that makes it work on more than one replica.
Package webauthn provides passkey registration and login over github.com/go-webauthn/webauthn, and the ceremony store that makes it work on more than one replica.
webauthn/cache
Package cache stores WebAuthn ceremony state in a cache.Cache.
Package cache stores WebAuthn ceremony state in a cache.Cache.
webauthn/config
Package webauthncfg assembles a WebAuthn relying party, and a cache-backed ceremony store, from environment configuration.
Package webauthncfg assembles a WebAuthn relying party, and a cache-backed ceremony store, from environment configuration.
webauthn/mock
Package webauthnmock provides moq-generated mock implementations of interfaces in the webauthn package.
Package webauthnmock provides moq-generated mock implementations of interfaces in the webauthn package.
webauthn/webauthntest
Package webauthntest holds the behavior every webauthn.SessionStore owes its callers, written once and run against each implementation.
Package webauthntest holds the behavior every webauthn.SessionStore owes its callers, written once and run against each implementation.
Package authorization answers "may this principal do this thing".
Package authorization answers "may this principal do this thing".
cached
Package cached wraps any authorization.PolicyResolver in a cache.
Package cached wraps any authorization.PolicyResolver in a cache.
config
Package authorizationcfg builds an authorization.PolicyResolver from configuration.
Package authorizationcfg builds an authorization.PolicyResolver from configuration.
grpc
Package grpc enforces authorization on gRPC methods.
Package grpc enforces authorization on gRPC methods.
http
Package http enforces authorization on HTTP routes.
Package http enforces authorization on HTTP routes.
mock
Package authorizationmock provides moq-generated mock implementations of interfaces in the authorization package.
Package authorizationmock provides moq-generated mock implementations of interfaces in the authorization package.
static
Package static provides an authorization.PolicyResolver whose policy is fixed at construction.
Package static provides an authorization.PolicyResolver whose policy is fixed at construction.
Package batching merges concurrent writes against a narrow key space into one write per process.
Package batching merges concurrent writes against a narrow key space into one write per process.
Package bitmask provides a generic, immutable bitmask type with set operations for unsigned integer types.
Package bitmask provides a generic, immutable bitmask type with set operations for unsigned integer types.
Package cache provides a generic caching interface with support for multiple backend implementations including Redis and in-memory stores.
Package cache provides a generic caching interface with support for multiple backend implementations including Redis and in-memory stores.
config
Package cachecfg selects and builds a cache.Cache[T] from configuration: either the in-process memory cache or Redis.
Package cachecfg selects and builds a cache.Cache[T] from configuration: either the in-process memory cache or Redis.
memory
Package memory is a cache.Cache held in a map in this process.
Package memory is a cache.Cache held in a map in this process.
mock
Package cachemock provides moq-generated mock implementations of interfaces in the cache package.
Package cachemock provides moq-generated mock implementations of interfaces in the cache package.
noop
Package noop is the cache.Cache for a caller who wants no cache at all: every read misses and every write is accepted and forgotten.
Package noop is the cache.Cache for a caller who wants no cache at all: every read misses and every write is accepted and forgotten.
redis
Package redis is a cache.Cache backed by Redis, in either single-node or cluster mode.
Package redis is a cache.Cache backed by Redis, in either single-node or cluster mode.
redis/slots
Package slots produces Redis Cluster keys whose slots are pre-planned to distribute evenly across the cluster's nodes.
Package slots produces Redis Cluster keys whose slots are pre-planned to distribute evenly across the cluster's nodes.
Package capitalism provides a payment management interface for handling subscription plans and payment provider webhooks.
Package capitalism provides a payment management interface for handling subscription plans and payment provider webhooks.
config
Package capitalismcfg builds both halves of the payments seam from one configuration — a capitalism.PaymentManager and a capitalism.UsageReporter — over Stripe, RevenueCat, or the noop provider.
Package capitalismcfg builds both halves of the payments seam from one configuration — a capitalism.PaymentManager and a capitalism.UsageReporter — over Stripe, RevenueCat, or the noop provider.
mock
Package capitalismmock provides mock implementations of the capitalism package's interfaces.
Package capitalismmock provides mock implementations of the capitalism package's interfaces.
noop
Package noop holds the capitalism implementations a deployment that does not bill runs, and the two are deliberately unalike.
Package noop holds the capitalism implementations a deployment that does not bill runs, and the two are deliberately unalike.
revenuecat
Package revenuecat translates RevenueCat's mobile subscription webhooks into capitalism's vocabulary.
Package revenuecat translates RevenueCat's mobile subscription webhooks into capitalism's vocabulary.
stripe
Package stripe provides Stripe functionality.
Package stripe provides Stripe functionality.
Package charset states which characters a string may be made of, as a value rather than as a loop written out again at every place that needs one.
Package charset states which characters a string may be made of, as a value rather than as a loop written out again at every place that needs one.
plainname
Package plainname validates plain names: the ones an operator writes into config — a plan name, a meter name — that then travel into cache keys, idempotency keys, metric attribute values, and permission strings.
Package plainname validates plain names: the ones an operator writes into config — a plan name, a meter name — that then travel into cache keys, idempotency keys, metric attribute values, and permission strings.
Package circuitbreaking implements the circuit breaker pattern for managing service availability and preventing cascading failures.
Package circuitbreaking implements the circuit breaker pattern for managing service availability and preventing cascading failures.
config
Package circuitbreakingcfg builds a circuitbreaking.CircuitBreaker from configuration.
Package circuitbreakingcfg builds a circuitbreaking.CircuitBreaker from configuration.
mock
Package circuitbreakingmock provides moq-generated mock implementations of the circuitbreaking package's interfaces.
Package circuitbreakingmock provides moq-generated mock implementations of the circuitbreaking package's interfaces.
noop
Package noop is the circuitbreaking.CircuitBreaker that never opens: CanProceed is always true, no matter how many failures are reported to it.
Package noop is the circuitbreaking.CircuitBreaker that never opens: CanProceed is always true, no matter how many failures are reported to it.
partitioned
Package partitioned provides a circuit breaker that is partitioned by key.
Package partitioned provides a circuit breaker that is partitioned by key.
partitioned/config
Package partitionedcfg builds a partitioned.KeyedCircuitBreaker from one base circuitbreakingcfg.Config: a breaker per declared key, plus a global one that every undeclared key shares.
Package partitionedcfg builds a partitioned.KeyedCircuitBreaker from one base circuitbreakingcfg.Config: a breaker per declared key, plus a global one that every undeclared key shares.
partitioned/mock
Package partitionedmock provides a moq-generated mock implementation of the partitioned package's KeyedCircuitBreaker interface.
Package partitionedmock provides a moq-generated mock implementation of the partitioned package's KeyedCircuitBreaker interface.
partitioned/noop
Package noop is the partitioned.KeyedCircuitBreaker that never opens for any key.
Package noop is the partitioned.KeyedCircuitBreaker that never opens for any key.
Package clock provides an injectable source of time so components that stamp, pace, or schedule work can be tested deterministically.
Package clock provides an injectable source of time so components that stamp, pace, or schedule work can be tested deterministically.
mock
Package clockmock provides moq-generated mock implementations of the clock package's interfaces.
Package clockmock provides moq-generated mock implementations of the clock package's interfaces.
Package compression provides data compression and decompression using Zstd and S2 algorithms.
Package compression provides data compression and decompression using Zstd and S2 algorithms.
Package config turns files and environment variables into the configuration structs the rest of this module is built around, and turns them back into files again.
Package config turns files and environment variables into the configuration structs the rest of this module is built around, and turns them back into files again.
cfgnorm
Package cfgnorm holds the normalization a config performs on itself before its own validation runs.
Package cfgnorm holds the normalization a config performs on itself before its own validation runs.
envvars
Package envvars derives the closed set of environment variables that can override a configuration struct, and writes it out as Go constants.
Package envvars derives the closed set of environment variables that can override a configuration struct, and writes it out as Go constants.
injection
Package injection holds the samber/do helpers shared by this module's do.Provide registrations.
Package injection holds the samber/do helpers shared by this module's do.Provide registrations.
Package cookies encodes values into cookies that a browser can hold and this service can later trust, and builds the *http.Cookie carrying them.
Package cookies encodes values into cookies that a browser can hold and this service can later trust, and builds the *http.Cookie carrying them.
config
Package cookiescfg registers a cookies.Manager with a do injector.
Package cookiescfg registers a cookies.Manager with a do injector.
cryptography
encryption
Package encryption provides authenticated encryption over a rotatable set of keys.
Package encryption provides authenticated encryption over a rotatable set of keys.
encryption/aes
Package aes contains the interfaces and implementations for encrypting and decrypting data.
Package aes contains the interfaces and implementations for encrypting and decrypting data.
encryption/config
Package encryptioncfg builds an encryption keyring over a caller-supplied encryption.Keyset, with one cipher provider — AES-256-GCM today — governing every key in the ring.
Package encryptioncfg builds an encryption keyring over a caller-supplied encryption.Keyset, with one cipher provider — AES-256-GCM today — governing every key in the ring.
encryption/kms
Package kms groups the encryption.KeyWrapper implementations.
Package kms groups the encryption.KeyWrapper implementations.
encryption/kms/aws
Package aws wraps key material with AWS KMS.
Package aws wraps key material with AWS KMS.
encryption/kms/gcp
Package gcp wraps key material with Google Cloud KMS.
Package gcp wraps key material with Google Cloud KMS.
encryption/kms/local
Package local wraps key material with an encryption.Cipher held in this process.
Package local wraps key material with an encryption.Cipher held in this process.
encryption/mock
Package encryptionmock provides moq-generated mock implementations of the encryption package's interfaces.
Package encryptionmock provides moq-generated mock implementations of the encryption package's interfaces.
hashing
Package hashing is the seam for reducing content to a digest, so that which algorithm computes it can be a runtime choice.
Package hashing is the seam for reducing content to a digest, so that which algorithm computes it can be a runtime choice.
hashing/adler32
Package adler32 implements hashing.Hasher using the Adler-32 checksum.
Package adler32 implements hashing.Hasher using the Adler-32 checksum.
hashing/canonical
Package canonical hashes Go values by content, producing the same digest for semantically identical values regardless of which process built them, in what order, or how their types declare fields.
Package canonical hashes Go values by content, producing the same digest for semantically identical values regardless of which process built them, in what order, or how their types declare fields.
hashing/crc64
Package crc64 implements hashing.Hasher using the CRC-64 (ISO) checksum, and exposes ChecksumISO for callers that want the checksum as the integer it natively is.
Package crc64 implements hashing.Hasher using the CRC-64 (ISO) checksum, and exposes ChecksumISO for callers that want the checksum as the integer it natively is.
hashing/fnv
Package fnv implements hashing.Hasher using the FNV-1a hash, and exposes Sum64a and Sum128a for callers that want the hash as the integer it natively is.
Package fnv implements hashing.Hasher using the FNV-1a hash, and exposes Sum64a and Sum128a for callers that want the hash as the integer it natively is.
hashing/hmac
Package hmac provides keyed hashing.Hasher implementations, for the cases where a digest has to prove who computed it rather than only what was computed.
Package hmac provides keyed hashing.Hasher implementations, for the cases where a digest has to prove who computed it rather than only what was computed.
hashing/sha256
Package sha256 implements hashing.Hasher using SHA-256, producing a 32-byte digest.
Package sha256 implements hashing.Hasher using SHA-256, producing a 32-byte digest.
hashing/sha512
Package sha512 implements hashing.Hasher using SHA-512, producing a 64-byte digest.
Package sha512 implements hashing.Hasher using SHA-512, producing a 64-byte digest.
requestsigning
Package requestsigning proves that an HTTP request body was produced by someone holding a shared key, and that it was produced recently.
Package requestsigning proves that an HTTP request body was produced by someone holding a shared key, and that it was produced recently.
requestsigning/http
Package http adapts requestsigning to inbound HTTP.
Package http adapts requestsigning to inbound HTTP.
Package database provides interface abstractions for interacting with relational data stores
Package database provides interface abstractions for interacting with relational data stores
config
Package databasecfg selects and builds a database.Client — Postgres, MySQL, or SQLite — and owns the connection strings each of them wants.
Package databasecfg selects and builds a database.Client — Postgres, MySQL, or SQLite — and owns the connection strings each of them wants.
ddl
Package ddl renders a package's embedded schema against a dialect and a table prefix, and vets the prefix against every identifier the schema would create.
Package ddl renders a package's embedded schema against a dialect and a table prefix, and vets the prefix against every identifier the schema would create.
dialect
Package dialect names the SQL dialects the module's SQL-emitting packages support, and carries the small helpers every one of them otherwise reimplements: bind-marker rendering, identifier vetting, and DDL statement splitting.
Package dialect names the SQL dialects the module's SQL-emitting packages support, and carries the small helpers every one of them otherwise reimplements: bind-marker rendering, identifier vetting, and DDL statement splitting.
internal/sqlclient
Package sqlclient holds the parts of a database.Client that do not vary by SQL driver.
Package sqlclient holds the parts of a database.Client that do not vary by SQL driver.
migrate
Package migrate provides the platform's standard database.Migrator: embedded SQL migrations with the operational discipline consumers otherwise hand-roll — an instance-based provider (no global goose state, so parallel tests never race), and on Postgres a session advisory lock that serializes concurrently booting replicas, with probe timeouts tightened so a waiting replica notices the winner promptly instead of goose's leisurely default.
Package migrate provides the platform's standard database.Migrator: embedded SQL migrations with the operational discipline consumers otherwise hand-roll — an instance-based provider (no global goose state, so parallel tests never race), and on Postgres a session advisory lock that serializes concurrently booting replicas, with probe timeouts tightened so a waiting replica notices the winner promptly instead of goose's leisurely default.
mock
Package databasemock provides moq-generated mocks for the database package.
Package databasemock provides moq-generated mocks for the database package.
mysql
Package mysql provides an interface for writing to a MySQL instance.
Package mysql provides an interface for writing to a MySQL instance.
mysql/tableaccess
Package tableaccess is the MySQL database.Manager: the administrative surface that creates users and databases and grants table privileges, as distinct from the query path a database.Client serves.
Package tableaccess is the MySQL database.Manager: the administrative surface that creates users and databases and grants table privileges, as distinct from the query path a database.Client serves.
postgres
Package postgres provides an interface for writing to a Postgres instance.
Package postgres provides an interface for writing to a Postgres instance.
postgres/pgnotify
Package pgnotify turns Postgres LISTEN/NOTIFY into a wake-up signal for a poller.
Package pgnotify turns Postgres LISTEN/NOTIFY into a wake-up signal for a poller.
postgres/pgretry
Package pgretry re-runs a Postgres write that failed for one of the two reasons Postgres resolves by asking the caller to run it again.
Package pgretry re-runs a Postgres write that failed for one of the two reasons Postgres resolves by asking the caller to run it again.
postgres/tableaccess
Package tableaccess is the PostgreSQL database.Manager: the administrative surface that creates roles and databases and grants table privileges, as distinct from the query path a database.Client serves.
Package tableaccess is the PostgreSQL database.Manager: the administrative surface that creates roles and databases and grants table privileges, as distinct from the query path a database.Client serves.
querygen
Package querygen emits sqlc input for tables shaped the way this module's row conventions expect, in the dialect of whichever of the three databases this module supports will run it.
Package querygen emits sqlc input for tables shaped the way this module's row conventions expect, in the dialect of whichever of the three databases this module supports will run it.
sqlguard
Package sqlguard runs the guarded write four durable-state packages in this module are built on, and says what it means when the guard matches nothing.
Package sqlguard runs the guarded write four durable-state packages in this module are built on, and says what it means when the guard matches nothing.
sqlite
Package sqlite provides an interface for writing to a SQLite database.
Package sqlite provides an interface for writing to a SQLite database.
sqlite/tableaccess
Package tableaccess is the SQLite database.Manager, and every one of its operations refuses.
Package tableaccess is the SQLite database.Manager, and every one of its operations refuses.
Package distributedlock provides a pessimistic mutual-exclusion atom for coordinating exclusive access to a named resource across processes.
Package distributedlock provides a pessimistic mutual-exclusion atom for coordinating exclusive access to a named resource across processes.
config
Package distributedlockcfg selects and builds a distributedlock.Locker, or a ScopedLocker, from configuration: Redis, Postgres, memory, or noop.
Package distributedlockcfg selects and builds a distributedlock.Locker, or a ScopedLocker, from configuration: Redis, Postgres, memory, or noop.
distributedlocktest
Package distributedlocktest holds the behavior every distributedlock.Locker and distributedlock.ScopedLocker owes its callers, written once and run against each implementation.
Package distributedlocktest holds the behavior every distributedlock.Locker and distributedlock.ScopedLocker owes its callers, written once and run against each implementation.
memory
Package memory implements distributedlock.Locker over a map and a mutex.
Package memory implements distributedlock.Locker over a map and a mutex.
mock
Package distributedlockmock provides moq-generated mock implementations of the distributedlock package's interfaces.
Package distributedlockmock provides moq-generated mock implementations of the distributedlock package's interfaces.
noop
Package noop is the distributedlock implementation for a deployment with nothing to coordinate with: Acquire always succeeds immediately, WithLock always runs fn, and TryWithLock always reports the lock as taken.
Package noop is the distributedlock implementation for a deployment with nothing to coordinate with: Acquire always succeeds immediately, WithLock always runs fn, and TryWithLock always reports the lock as taken.
postgres
Package postgres implements distributedlock.Locker against PostgreSQL session- scoped advisory locks (pg_try_advisory_lock).
Package postgres implements distributedlock.Locker against PostgreSQL session- scoped advisory locks (pg_try_advisory_lock).
redis
Package redis implements distributedlock.Locker with a single Redis key per lock.
Package redis implements distributedlock.Locker with a single Redis key per lock.
Package email sends transactional mail, over one of six vendors or nowhere at all.
Package email sends transactional mail, over one of six vendors or nowhere at all.
config
Package emailcfg selects and builds an email.Emailer from configuration over six vendors — SendGrid, Mailgun, Mailjet, Resend, Postmark, SES — or the noop emailer.
Package emailcfg selects and builds an email.Emailer from configuration over six vendors — SendGrid, Mailgun, Mailjet, Resend, Postmark, SES — or the noop emailer.
mailgun
Package mailgun sends email through Mailgun.
Package mailgun sends email through Mailgun.
mailjet
Package mailjet sends email through Mailjet.
Package mailjet sends email through Mailjet.
mock
Package emailmock provides moq-generated mock implementations of the email package's interfaces.
Package emailmock provides moq-generated mock implementations of the email package's interfaces.
noop
Package noop is the email.Emailer that sends nothing.
Package noop is the email.Emailer that sends nothing.
postmark
Package postmark sends email through Postmark.
Package postmark sends email through Postmark.
resend
Package resend sends email through Resend.
Package resend sends email through Resend.
sendgrid
Package sendgrid sends email through SendGrid.
Package sendgrid sends email through SendGrid.
ses
Package ses sends email through Amazon SES v2.
Package ses sends email through Amazon SES v2.
Package embeddings provides a vector embedding interface with implementations for OpenAI, Ollama, and Cohere providers.
Package embeddings provides a vector embedding interface with implementations for OpenAI, Ollama, and Cohere providers.
cohere
Package cohere generates vector embeddings through Cohere's v2 embed API.
Package cohere generates vector embeddings through Cohere's v2 embed API.
config
Package embeddingscfg selects and builds an embeddings.Embedder from configuration: OpenAI, Ollama, Cohere, or the noop embedder.
Package embeddingscfg selects and builds an embeddings.Embedder from configuration: OpenAI, Ollama, Cohere, or the noop embedder.
mock
Package embeddingsmock provides moq-generated mock implementations of the embeddings package's interfaces.
Package embeddingsmock provides moq-generated mock implementations of the embeddings package's interfaces.
noop
Package noop is the embeddings.Embedder for a deployment that runs no model, and the thing to know is that it does not return nothing.
Package noop is the embeddings.Embedder for a deployment that runs no model, and the thing to know is that it does not return nothing.
ollama
Package ollama generates vector embeddings through a running Ollama instance.
Package ollama generates vector embeddings through a running Ollama instance.
openai
Package openai generates vector embeddings through OpenAI's embeddings API.
Package openai generates vector embeddings through OpenAI's embeddings API.
Package encoding turns values into bytes and back, in a content type chosen by configuration rather than by the call site.
Package encoding turns values into bytes and back, in a content type chosen by configuration rather than by the call site.
mock
Package encodingmock provides moq-generated mocks for the encoding package.
Package encodingmock provides moq-generated mocks for the encoding package.
Package errors re-exports cockroachdb/errors utilities and defines platform-level sentinel error values and HTTP/gRPC error conversion helpers.
Package errors re-exports cockroachdb/errors utilities and defines platform-level sentinel error values and HTTP/gRPC error conversion helpers.
grpc
Package grpc translates errors into gRPC statuses, and back again on the other side of the wire.
Package grpc translates errors into gRPC statuses, and back again on the other side of the wire.
http
Package http translates errors into HTTP responses, in both directions.
Package http translates errors into HTTP responses, in both directions.
Package eventcapture records high-volume operational events for offline analysis — model training data, usage matrices, replayable traces — without ever slowing the request path that produces them.
Package eventcapture records high-volume operational events for offline analysis — model training data, usage matrices, replayable traces — without ever slowing the request path that produces them.
jsonl
Package jsonl implements eventcapture.Sink as an append-only, size-rotated, newline-delimited JSON file.
Package jsonl implements eventcapture.Sink as an append-only, size-rotated, newline-delimited JSON file.
mock
Package eventcapturemock provides moq-generated mock implementations of the eventcapture package's interfaces.
Package eventcapturemock provides moq-generated mock implementations of the eventcapture package's interfaces.
noop
Package noop provides a no-op eventcapture.Sink, for deployments with capture wired but disabled.
Package noop provides a no-op eventcapture.Sink, for deployments with capture wired but disabled.
Package eventstream provides event streaming abstractions for server-to-client and bidirectional communication over HTTP, with implementations for SSE and WebSocket.
Package eventstream provides event streaming abstractions for server-to-client and bidirectional communication over HTTP, with implementations for SSE and WebSocket.
config
Package eventstreamcfg selects and builds an eventstream upgrader from configuration: SSE or WebSocket.
Package eventstreamcfg selects and builds an eventstream upgrader from configuration: SSE or WebSocket.
noop
Package noop is the eventstream implementation for a caller with no transport to stream over.
Package noop is the eventstream implementation for a caller with no transport to stream over.
sse
Package sse upgrades an HTTP request to a Server-Sent Events stream.
Package sse upgrades an HTTP request to a Server-Sent Events stream.
websocket
Package websocket upgrades an HTTP request to a WebSocket event stream, over gorilla/websocket.
Package websocket upgrades an HTTP request to a WebSocket event stream, over gorilla/websocket.
Package fake provides generic test data generation utilities for creating fake instances of any type.
Package fake provides generic test data generation utilities for creating fake instances of any type.
Package featureflags provides a feature flag evaluation interface for controlling feature availability per user, with implementations for LaunchDarkly and PostHog.
Package featureflags provides a feature flag evaluation interface for controlling feature availability per user, with implementations for LaunchDarkly and PostHog.
config
Package featureflagscfg selects and builds a featureflags.FeatureFlagManager from configuration: LaunchDarkly, PostHog, or the noop manager.
Package featureflagscfg selects and builds a featureflags.FeatureFlagManager from configuration: LaunchDarkly, PostHog, or the noop manager.
internal/openfeatureflags
Package openfeatureflags is the flag evaluation both of this module's OpenFeature-backed providers do.
Package openfeatureflags is the flag evaluation both of this module's OpenFeature-backed providers do.
launchdarkly
Package launchdarkly evaluates feature flags against LaunchDarkly, by way of OpenFeature.
Package launchdarkly evaluates feature flags against LaunchDarkly, by way of OpenFeature.
mock
Package featureflagsmock provides mock implementations of the featureflags package's interfaces.
Package featureflagsmock provides mock implementations of the featureflags package's interfaces.
noop
Package noop is the featureflags.FeatureFlagManager for a process with no flag system: each typed getter returns the default value it was handed, and CanUseFeature returns false.
Package noop is the featureflags.FeatureFlagManager for a process with no flag system: each typed getter returns the default value it was handed, and CanUseFeature returns false.
posthog
Package posthog evaluates feature flags against PostHog, by way of OpenFeature.
Package posthog evaluates feature flags against PostHog, by way of OpenFeature.
Package files provides ergonomic helpers for reading text files: iterating line by line or in fixed-size chunks, streaming chunks asynchronously off large files, slicing a window of lines, and decoding a structured file into a typed value via the encoding package.
Package files provides ergonomic helpers for reading text files: iterating line by line or in fixed-size chunks, streaming chunks asynchronously off large files, slicing a window of lines, and decoding a structured file into a typed value via the encoding package.
Package filtering is the shared vocabulary for list queries: which slice of a collection a caller asked for, and which slice they got.
Package filtering is the shared vocabulary for list queries: which slice of a collection a caller asked for, and which slice they got.
grpc
Package grpc is the wire conversion for filtering's two types: the QueryFilter a caller sends and the Pagination they are answered with, to and from the generated messages in filtering/filteringpb.
Package grpc is the wire conversion for filtering's two types: the QueryFilter a caller sends and the Pagination they are answered with, to and from the generated messages in filtering/filteringpb.
Package healthcheck provides health check monitoring for service components with status tracking and aggregation via a registry pattern.
Package healthcheck provides health check monitoring for service components with status tracking and aggregation via a registry pattern.
Package httpclient constructs HTTP clients with optional OpenTelemetry tracing instrumentation, resilience middleware, and response caching.
Package httpclient constructs HTTP clients with optional OpenTelemetry tracing instrumentation, resilience middleware, and response caching.
Package idempotency runs work at most once per client-supplied key.
Package idempotency runs work at most once per client-supplied key.
config
Package idempotencycfg assembles an idempotency.Manager from environment configuration.
Package idempotencycfg assembles an idempotency.Manager from environment configuration.
grpc
Package grpc adapts idempotency to gRPC, on both sides of the wire.
Package grpc adapts idempotency to gRPC, on both sides of the wire.
http
Package http adapts idempotency to HTTP, on both sides of the wire.
Package http adapts idempotency to HTTP, on both sides of the wire.
Package identifiers is a handy place to request a new string identifier from.
Package identifiers is a handy place to request a new string identifier from.
internal
cbormode
Package cbormode holds the one CBOR dialect this module speaks, so that the encoding package and the cache codec cannot drift into two incompatible spellings of the same format.
Package cbormode holds the one CBOR dialect this module speaks, so that the encoding package and the cache codec cannot drift into two incompatible spellings of the same format.
redisclient
Package redisclient builds the go-redis client every Redis-backed package in this module talks through.
Package redisclient builds the go-redis client every Redis-backed package in this module talks through.
tierguard
Package tierguard holds the one rule this module cannot state in Go's type system, and it holds nothing else: nothing here imports platform-go.
Package tierguard holds the one rule this module cannot state in Go's type system, and it holds nothing else: nothing here imports platform-go.
Package jobs supplies the lifecycle around background work: a bounded pool of workers consuming a queue, and a scheduler that runs periodic work once across a fleet.
Package jobs supplies the lifecycle around background work: a bounded pool of workers consuming a queue, and a scheduler that runs periodic work once across a fleet.
config
Package jobscfg assembles the jobs package from environment configuration: a Pool bound to a messagequeue consumer, and a Scheduler holding its periodic executions under a distributed lock.
Package jobscfg assembles the jobs package from environment configuration: a Pool bound to a messagequeue consumer, and a Scheduler holding its periodic executions under a distributed lock.
llm
Package llm is the platform's interface to language models: content blocks, tool calling, streaming, structured output, and token accounting, over Anthropic and OpenAI.
Package llm is the platform's interface to language models: content blocks, tool calling, streaming, structured output, and token accounting, over Anthropic and OpenAI.
anthropic
Package anthropic is the Anthropic-backed llm.Provider.
Package anthropic is the Anthropic-backed llm.Provider.
config
Package llmcfg selects and builds an llm.Provider from configuration: OpenAI, Anthropic, or the noop provider.
Package llmcfg selects and builds an llm.Provider from configuration: OpenAI, Anthropic, or the noop provider.
internal/bridge
Package bridge translates between the platform's llm types and any-llm-go's.
Package bridge translates between the platform's llm types and any-llm-go's.
mock
Package llmmock provides mock implementations of the llm package's interfaces.
Package llmmock provides mock implementations of the llm package's interfaces.
noop
Package noop is the llm.Provider that spends nothing: Completion returns an empty response that stopped at llm.StopReasonEndTurn, and Stream returns a stream carrying only llm.EventDone.
Package noop is the llm.Provider that spends nothing: Completion returns an empty response that stopped at llm.StopReasonEndTurn, and Stream returns a stream carrying only llm.EventDone.
openai
Package openai is the OpenAI-backed llm.Provider.
Package openai is the OpenAI-backed llm.Provider.
Package messagequeue provides message queue publisher and consumer interfaces with implementations for Google Pub/Sub, Redis, and Amazon SQS.
Package messagequeue provides message queue publisher and consumer interfaces with implementations for Google Pub/Sub, Redis, and Amazon SQS.
config
Package messagequeuecfg selects and builds messagequeue publisher and consumer providers from configuration, over Redis, SQS, GCP Pub/Sub, Kafka, or noop.
Package messagequeuecfg selects and builds messagequeue publisher and consumer providers from configuration, over Redis, SQS, GCP Pub/Sub, Kafka, or noop.
internal/consumererr
Package consumererr holds the send every messagequeue Consumer uses to report a handler or broker failure on the caller's error channel.
Package consumererr holds the send every messagequeue Consumer uses to report a handler or broker failure on the caller's error channel.
internal/mqmetrics
Package mqmetrics holds the instruments every messagequeue broker records, so that the four brokers agree on what each number means.
Package mqmetrics holds the instruments every messagequeue broker records, so that the four brokers agree on what each number means.
internal/receivewait
Package receivewait paces a consumer's receive loop after a failed receive.
Package receivewait paces a consumer's receive loop after a failed receive.
kafka
Package kafka is a messagequeue publisher and consumer over Apache Kafka.
Package kafka is a messagequeue publisher and consumer over Apache Kafka.
mock
Package messagequeuemock provides moq-generated mocks for the messagequeue package's Publisher, PublisherProvider, Consumer, and ConsumerProvider interfaces.
Package messagequeuemock provides moq-generated mocks for the messagequeue package's Publisher, PublisherProvider, Consumer, and ConsumerProvider interfaces.
noop
Package noop is the messagequeue publisher and consumer pair for a service with no broker.
Package noop is the messagequeue publisher and consumer pair for a service with no broker.
pubsub
Package pubsub is a messagequeue publisher and consumer over Google Cloud Pub/Sub.
Package pubsub is a messagequeue publisher and consumer over Google Cloud Pub/Sub.
redis
Package redis is a messagequeue publisher and consumer over Redis pub/sub.
Package redis is a messagequeue publisher and consumer over Redis pub/sub.
sqs
Package sqs is a messagequeue publisher and consumer over Amazon SQS.
Package sqs is a messagequeue publisher and consumer over Amazon SQS.
notifications
mobile
Package mobile provides a push notification sending interface with implementations for APNs and FCM.
Package mobile provides a push notification sending interface with implementations for APNs and FCM.
mobile/apns
Package apns sends push notifications to iOS devices through Apple's APNs.
Package apns sends push notifications to iOS devices through Apple's APNs.
mobile/config
Package mobilecfg selects and builds a mobile.PushSender from configuration: APNs for iOS, FCM for Android, apns_fcm for both, or noop.
Package mobilecfg selects and builds a mobile.PushSender from configuration: APNs for iOS, FCM for Android, apns_fcm for both, or noop.
mobile/fcm
Package fcm sends push notifications to Android devices through Firebase Cloud Messaging.
Package fcm sends push notifications to Android devices through Firebase Cloud Messaging.
mobile/internal/pushfeedback
Package pushfeedback holds the one sentinel a provider sender marks a permanently-rejected device token with.
Package pushfeedback holds the one sentinel a provider sender marks a permanently-rejected device token with.
mobile/noop
Package noop is the mobile.PushNotificationSender for a deployment with no APNs or FCM credentials.
Package noop is the mobile.PushNotificationSender for a deployment with no APNs or FCM credentials.
Package numbers provides numeric types, utilities, and range abstractions for rounding, scaling, and yield adjustment calculations.
Package numbers provides numeric types, utilities, and range abstractions for rounding, scaling, and yield adjustment calculations.
Package observability provides unified configuration and initialization for the four observability pillars: logging, metrics, tracing, and profiling.
Package observability provides unified configuration and initialization for the four observability pillars: logging, metrics, tracing, and profiling.
keys
Package keys is the module's attribute-name vocabulary: the string constants every package uses when it puts a value on a span or a log line.
Package keys is the module's attribute-name vocabulary: the string constants every package uses when it puts a value on a span or a log line.
logging
Package logging is the Logger seam every package in this module writes through, and the noop that stands in when a caller supplies none.
Package logging is the Logger seam every package in this module writes through, and the noop that stands in when a caller supplies none.
logging/config
Package loggingcfg selects and builds a logging.Logger from configuration: zerolog, zap, slog, the OTel-exporting slog, or none at all.
Package loggingcfg selects and builds a logging.Logger from configuration: zerolog, zap, slog, the OTel-exporting slog, or none at all.
logging/noop
Package noop is the logging.Logger that writes nowhere.
Package noop is the logging.Logger that writes nowhere.
logging/otelgrpc
Package otelgrpc implements logging.Logger over log/slog, fanning every record out to both stdout and an OTLP collector reached over gRPC.
Package otelgrpc implements logging.Logger over log/slog, fanning every record out to both stdout and an OTLP collector reached over gRPC.
logging/slog
Package slog implements logging.Logger over the standard library's log/slog, emitting JSON to stdout.
Package slog implements logging.Logger over the standard library's log/slog, emitting JSON to stdout.
logging/zap
Package zap implements logging.Logger over uber-go/zap.
Package zap implements logging.Logger over uber-go/zap.
logging/zerolog
Package zerolog implements logging.Logger over rs/zerolog.
Package zerolog implements logging.Logger over rs/zerolog.
metrics
Package metrics provides a metrics-tracking implementation for the service.
Package metrics provides a metrics-tracking implementation for the service.
metrics/config
Package metricscfg selects and builds a metrics.Provider from configuration: the OTel gRPC exporter, or no metrics at all.
Package metricscfg selects and builds a metrics.Provider from configuration: the OTel gRPC exporter, or no metrics at all.
metrics/metricstest
Package metricstest provides metric instruments for tests.
Package metricstest provides metric instruments for tests.
metrics/mock
Package metricsmock provides moq-generated mocks for the metrics package.
Package metricsmock provides moq-generated mocks for the metrics package.
metrics/noop
Package noop is the metrics.Provider that exports nothing.
Package noop is the metrics.Provider that exports nothing.
metrics/otelgrpc
Package otelgrpc implements metrics.Provider against an OTLP collector reached over gRPC.
Package otelgrpc implements metrics.Provider against an OTLP collector reached over gRPC.
profiling
Package profiling is the seam for continuous profiling: the fourth observability pillar, and the one that is not a dependency of anything.
Package profiling is the seam for continuous profiling: the fourth observability pillar, and the one that is not a dependency of anything.
profiling/config
Package profilingcfg selects and builds a profiling.Provider from configuration: Grafana Pyroscope, the Go-native pprof HTTP server, or no profiling at all.
Package profilingcfg selects and builds a profiling.Provider from configuration: Grafana Pyroscope, the Go-native pprof HTTP server, or no profiling at all.
profiling/noop
Package noop is the profiling.Provider for a deployment that ships no profiles.
Package noop is the profiling.Provider for a deployment that ships no profiles.
profiling/pprof
Package pprof implements profiling.Provider by serving net/http/pprof from a dedicated HTTP server.
Package pprof implements profiling.Provider by serving net/http/pprof from a dedicated HTTP server.
profiling/pyroscope
Package pyroscope implements profiling.Provider by pushing profiles continuously to a Pyroscope server.
Package pyroscope implements profiling.Provider by pushing profiles continuously to a Pyroscope server.
tracing
Package tracing provides distributed tracing utilities.
Package tracing provides distributed tracing utilities.
tracing/cloudtrace
Package cloudtrace provides common functions for attaching values to trace spans
Package cloudtrace provides common functions for attaching values to trace spans
tracing/config
Package tracingcfg selects and builds a tracing.Provider from configuration: the OTel gRPC exporter, GCP Cloud Trace, or no tracing at all.
Package tracingcfg selects and builds a tracing.Provider from configuration: the OTel gRPC exporter, GCP Cloud Trace, or no tracing at all.
tracing/noop
Package noop is the tracing.Provider that records no spans, and the detail worth knowing about it is that it still propagates.
Package noop is the tracing.Provider that records no spans, and the detail worth knowing about it is that it still propagates.
tracing/oteltrace
Package oteltrace provides common functions for attaching values to trace spans
Package oteltrace provides common functions for attaching values to trace spans
utils
Package o11yutils offers observability utility functions.
Package o11yutils offers observability utility functions.
Package panicking provides an abstraction over panic behavior, enabling testing and mocking of panic-inducing code paths.
Package panicking provides an abstraction over panic behavior, enabling testing and mocking of panic-inducing code paths.
mock
Package panickingmock provides moq-generated mock implementations of the panicking package's interfaces.
Package panickingmock provides moq-generated mock implementations of the panicking package's interfaces.
Package pointer provides generic utility functions for creating pointers to values and dereferencing pointer values and slices.
Package pointer provides generic utility functions for creating pointers to values and dereferencing pointer values and slices.
Package qrcodes provides QR code generation for TOTP two-factor authentication setup.
Package qrcodes provides QR code generation for TOTP two-factor authentication setup.
noop
Package noop is the qrcodes.Builder that draws nothing.
Package noop is the qrcodes.Builder that draws nothing.
Package random provides cryptographically secure random string generation in hex, base32, and base64 encodings.
Package random provides cryptographically secure random string generation in hex, base32, and base64 encodings.
mock
Package randommock provides moq-generated mock implementations of the random package's interfaces.
Package randommock provides moq-generated mock implementations of the random package's interfaces.
noop
Package noop is the random.Generator that has nothing to draw from: every method returns random.ErrNoRandomness and no value.
Package noop is the random.Generator that has nothing to draw from: every method returns random.ErrNoRandomness and no value.
Package ratelimiting provides a per-key rate limiter interface using the token bucket algorithm.
Package ratelimiting provides a per-key rate limiter interface using the token bucket algorithm.
config
Package ratelimitingcfg selects and builds a rate limiter from configuration: the in-process memory limiter, the Redis-backed one, or noop.
Package ratelimitingcfg selects and builds a rate limiter from configuration: the in-process memory limiter, the Redis-backed one, or noop.
grpc
Package grpc adapts ratelimiting to inbound gRPC.
Package grpc adapts ratelimiting to inbound gRPC.
http
Package http adapts ratelimiting to inbound HTTP.
Package http adapts ratelimiting to inbound HTTP.
noop
Package noop is the ratelimiting.RateLimiter that never limits: Allow returns true for every key, and there is no counter, window, or store behind it to consult.
Package noop is the ratelimiting.RateLimiter that never limits: Allow returns true for every key, and there is no counter, window, or store behind it to consult.
redis
Package redis implements ratelimiting.RateLimiter as a sliding window kept in a Redis sorted set.
Package redis implements ratelimiting.RateLimiter as a sliding window kept in a Redis sorted set.
Package reflection provides utilities for struct field inspection, tag extraction, and dynamic method introspection.
Package reflection provides utilities for struct field inspection, tag extraction, and dynamic method introspection.
ast
Package ast reads Go source as text: the helpers a code generator or an analysis tool needs to walk a repository's files and learn what is declared in them.
Package ast reads Go source as text: the helpers a code generator or an analysis tool needs to walk a repository's files and learn what is declared in them.
Package retry provides retry policies for resilient operation execution.
Package retry provides retry policies for resilient operation execution.
config
Package retrycfg builds a retry.Policy from configuration — exponential backoff, which an unset provider selects, or noop, which has to be named.
Package retrycfg builds a retry.Policy from configuration — exponential backoff, which an unset provider selects, or noop, which has to be named.
noop
Package noop is the retry.Policy that does not retry: Execute calls the operation once and returns whatever the operation returned.
Package noop is the retry.Policy that does not retry: Execute calls the operation once and returns whatever the operation returned.
Package routing provides a declarative, type-safe HTTP router that generates an OpenAPI 3 specification as routes are registered.
Package routing provides a declarative, type-safe HTTP router that generates an OpenAPI 3 specification as routes are registered.
backends/chi
Package chi provides a routing.Backend built on go-chi/chi.
Package chi provides a routing.Backend built on go-chi/chi.
backends/gin
Package gin provides a routing.Backend built on gin-gonic/gin.
Package gin provides a routing.Backend built on gin-gonic/gin.
backends/httprouter
Package httprouter provides a routing.Backend built on julienschmidt/httprouter, a fast radix-tree router.
Package httprouter provides a routing.Backend built on julienschmidt/httprouter, a fast radix-tree router.
backends/internal/conformance
Package conformance holds the tests that pin every routing.Backend to one answer, rather than to whatever its underlying library happens to do.
Package conformance holds the tests that pin every routing.Backend to one answer, rather than to whatever its underlying library happens to do.
backends/internal/httpmw
Package httpmw holds the net/http middleware stack shared by every routing backend.
Package httpmw holds the net/http middleware stack shared by every routing backend.
backends/internal/pathvalues
Package pathvalues holds the one decode step every routing backend that matches on the escaped path owes its callers.
Package pathvalues holds the one decode step every routing backend that matches on the escaped path owes its callers.
backends/stdlib
Package stdlib provides a routing.Backend built on the standard library's net/http.ServeMux.
Package stdlib provides a routing.Backend built on the standard library's net/http.ServeMux.
config
Package routingcfg selects and builds a routing backend from configuration: chi, net/http's ServeMux, httprouter, or gin.
Package routingcfg selects and builds a routing backend from configuration: chi, net/http's ServeMux, httprouter, or gin.
mock
Package routingmock provides mock implementations of the routing package's interfaces (currently the Backend seam), for testing routers without a real mux library.
Package routingmock provides mock implementations of the routing package's interfaces (currently the Backend seam), for testing routers without a real mux library.
Package search is the parent of this module's four search packages and holds no code of its own.
Package search is the parent of this module's four search packages and holds no code of its own.
pagination
Package searchpagination adapts a text index's cursor pagination to the filtering.QueryFilter pagination an API hands back to clients, and runs the index-then-hydrate loop that a text search always is.
Package searchpagination adapts a text index's cursor pagination to the filtering.QueryFilter pagination an API hands back to clients, and runs the index-then-hydrate loop that a text search always is.
text
Package textsearch defines an interface for a search index management structure
Package textsearch defines an interface for a search index management structure
text/algolia
Package algolia provides an interface-compatible wrapper around the algolia indexer
Package algolia provides an interface-compatible wrapper around the algolia indexer
text/config
Package textsearchcfg selects and builds a text search index from configuration: Elasticsearch, Algolia, or noop.
Package textsearchcfg selects and builds a text search index from configuration: Elasticsearch, Algolia, or noop.
text/elasticsearch
Package elasticsearch provides an interface-compatible wrapper around the elasticsearch indexer
Package elasticsearch provides an interface-compatible wrapper around the elasticsearch indexer
text/mock
Package textsearchmock provides moq-generated mocks for the search/text package.
Package textsearchmock provides moq-generated mocks for the search/text package.
text/noop
Package noop is the textsearch.Index for a service with no search cluster: Index, Delete, and Wipe all succeed and keep nothing, and Search returns zero hits.
Package noop is the textsearch.Index for a service with no search cluster: Index, Delete, and Wipe all succeed and keep nothing, and Search returns zero hits.
vector
Package vectorsearch provides a generic interface for vector (nearest-neighbor) search backends, parallel to the textsearch package under search/text.
Package vectorsearch provides a generic interface for vector (nearest-neighbor) search backends, parallel to the textsearch package under search/text.
vector/config
Package vectorsearchcfg selects and builds a vector search index from configuration: pgvector, Qdrant, or noop.
Package vectorsearchcfg selects and builds a vector search index from configuration: pgvector, Qdrant, or noop.
vector/mock
Package vectorsearchmock provides moq-generated mocks for the search/vector package.
Package vectorsearchmock provides moq-generated mocks for the search/vector package.
vector/noop
Package noop is the vectorsearch.Index for a deployment running no vector store: Upsert, Delete, and Wipe report success without keeping anything, and Query returns an empty result slice.
Package noop is the vectorsearch.Index for a deployment running no vector store: Upsert, Delete, and Wipe report success without keeping anything, and Query returns an empty result slice.
vector/pgvector
Package pgvector implements vectorsearch.Index against a PostgreSQL database running the pgvector extension.
Package pgvector implements vectorsearch.Index against a PostgreSQL database running the pgvector extension.
vector/qdrant
Package qdrant implements vectorsearch.Index against a Qdrant vector database over its REST API.
Package qdrant implements vectorsearch.Index against a Qdrant vector database over its REST API.
Package secrets provides a secret retrieval interface with implementations for environment variables, GCP Secret Manager, AWS SSM Parameter Store, and Kubernetes secrets.
Package secrets provides a secret retrieval interface with implementations for environment variables, GCP Secret Manager, AWS SSM Parameter Store, and Kubernetes secrets.
config
Package secretscfg selects and builds a secrets.SecretSource from configuration: environment variables, GCP Secret Manager, AWS SSM Parameter Store, Kubernetes secrets, or noop.
Package secretscfg selects and builds a secrets.SecretSource from configuration: environment variables, GCP Secret Manager, AWS SSM Parameter Store, Kubernetes secrets, or noop.
env
Package env reads secrets from this process's environment.
Package env reads secrets from this process's environment.
gcp
Package gcp reads secrets from GCP Secret Manager.
Package gcp reads secrets from GCP Secret Manager.
kubernetes
Package kubernetes sources secrets from the Kubernetes Secrets API.
Package kubernetes sources secrets from the Kubernetes Secrets API.
noop
Package noop is the secrets.SecretSource that holds no secrets, and how it says so is the thing to know: GetSecret returns secrets.ErrSecretNotFound for every name it is ever asked.
Package noop is the secrets.SecretSource that holds no secrets, and how it says so is the thing to know: GetSecret returns secrets.ErrSecretNotFound for every name it is ever asked.
ssm
Package ssm reads secrets from AWS SSM Parameter Store.
Package ssm reads secrets from AWS SSM Parameter Store.
server
grpc
Package grpc builds the gRPC server this module's services are served from: the listener, the interceptor chain, TLS, health, and a shutdown that drains before it flushes.
Package grpc builds the gRPC server this module's services are served from: the listener, the interceptor chain, TLS, health, and a shutdown that drains before it flushes.
http
Package http is the module's HTTP server: a listener, a github.com/primandproper/primitives-go/routing router, a graceful shutdown, and the handful of endpoints that belong to the process rather than to the API it serves.
Package http is the module's HTTP server: a listener, a github.com/primandproper/primitives-go/routing router, a graceful shutdown, and the handful of endpoints that belong to the process rather than to the API it serves.
Package tenancy carries one dimension: whose data a row is.
Package tenancy carries one dimension: whose data a row is.
Package testutils contains common functions for integration/load tests
Package testutils contains common functions for integration/load tests
containers
Package containers provides shared helpers for starting testcontainers with uniform retry behavior.
Package containers provides shared helpers for starting testcontainers with uniform retry behavior.
containers/mysqltest
Package mysqltest provides the MySQL testcontainer setup that every MySQL-backed suite in this repo would otherwise hand-roll: start the container with the shared retry policy and wait strategy, open a go-sql-driver pool against it, ping it, and tear all of it down afterwards.
Package mysqltest provides the MySQL testcontainer setup that every MySQL-backed suite in this repo would otherwise hand-roll: start the container with the shared retry policy and wait strategy, open a go-sql-driver pool against it, ping it, and tear all of it down afterwards.
containers/pgtest
Package pgtest provides the postgres testcontainer setup that every postgres-backed suite in this repo would otherwise hand-roll: start the container with the shared retry policy and wait strategy, open a pgx-backed *sql.DB against it, ping it, and tear all of it down afterwards.
Package pgtest provides the postgres testcontainer setup that every postgres-backed suite in this repo would otherwise hand-roll: start the container with the shared retry policy and wait strategy, open a pgx-backed *sql.DB against it, ping it, and tear all of it down afterwards.
containers/redistest
Package redistest provides a single source of truth for the redis testcontainer setup that the redis-backed test suites in this repo all duplicate.
Package redistest provides a single source of truth for the redis testcontainer setup that the redis-backed test suites in this repo all duplicate.
Package uploads provides an object storage abstraction for saving and reading files, with implementations backed by S3, GCS, Cloudflare R2, Backblaze B2, the local filesystem, and an in-memory provider (see the objectstorage subpackage).
Package uploads provides an object storage abstraction for saving and reading files, with implementations backed by S3, GCS, Cloudflare R2, Backblaze B2, the local filesystem, and an in-memory provider (see the objectstorage subpackage).
config
Package uploadscfg carries the uploads configuration and hands its object storage half to a do injector.
Package uploadscfg carries the uploads configuration and hands its object storage half to a do injector.
images
Package images provides small, pure helpers for validating, encoding, and thumbnailing images.
Package images provides small, pure helpers for validating, encoding, and thumbnailing images.
mock
Package uploadsmock provides moq-generated mock implementations of the uploads package interfaces (UploadManager and the optional capability interfaces) for use in tests.
Package uploadsmock provides moq-generated mock implementations of the uploads package interfaces (UploadManager and the optional capability interfaces) for use in tests.
noop
Package noop is the uploads.UploadManager that stores nothing, and it is the only implementation here that can still return an error.
Package noop is the uploads.UploadManager that stores nothing, and it is the only implementation here that can still return an error.
objectstorage
Package objectstorage is the uploads.UploadManager backed by gocloud.dev/blob.
Package objectstorage is the uploads.UploadManager backed by gocloud.dev/blob.
Package version manages build-time version and VCS metadata injection via linker flags.
Package version manages build-time version and VCS metadata injection via linker flags.
webhooks
inbound
Package inbound receives webhooks: it verifies the provider's signature over the bytes as they arrived, publishes the delivery to a message queue, and acks.
Package inbound receives webhooks: it verifies the provider's signature over the bytes as they arrived, publishes the delivery to a message queue, and acks.
inbound/config
Package inboundcfg assembles an inbound webhook receiver from environment configuration: the Verifier for the provider's signing scheme, and the Receiver that mounts on a router and publishes what it verifies.
Package inboundcfg assembles an inbound webhook receiver from environment configuration: the Verifier for the provider's signing scheme, and the Receiver that mounts on a router and publishes what it verifies.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL