Directories
¶
| Path | Synopsis |
|---|---|
|
Package auth provides enterprise-grade authentication tools.
|
Package auth provides enterprise-grade authentication tools. |
|
middleware/echo
Package echoauth provides JWT authentication middleware for Echo.
|
Package echoauth provides JWT authentication middleware for Echo. |
|
middleware/fiber
Package fiberauth provides JWT authentication middleware for Fiber.
|
Package fiberauth provides JWT authentication middleware for Fiber. |
|
middleware/gin
Package ginauth provides JWT authentication middleware for Gin.
|
Package ginauth provides JWT authentication middleware for Gin. |
|
middleware/internal/authhttp
Package authhttp contains framework-neutral HTTP authentication helpers used by the Fiber, Gin, Echo, and net/http middleware adapters.
|
Package authhttp contains framework-neutral HTTP authentication helpers used by the Fiber, Gin, Echo, and net/http middleware adapters. |
|
middleware/nethttp
Package nethttpauth provides authentication middleware for the standard library's net/http package.
|
Package nethttpauth provides authentication middleware for the standard library's net/http package. |
|
Package cache provides JSON-aware helper functions built on top of the Cache interface.
|
Package cache provides JSON-aware helper functions built on top of the Cache interface. |
|
Package config provides a simple, structured way to load application configuration from both files (like .yaml or .env) and environment variables.
|
Package config provides a simple, structured way to load application configuration from both files (like .yaml or .env) and environment variables. |
|
Package cron provides in-process scheduling with optional Redis leases.
|
Package cron provides in-process scheduling with optional Redis leases. |
|
db
|
|
|
migration
Package migration manages versioned SQL database migrations from an embedded filesystem.
|
Package migration manages versioned SQL database migrations from an embedded filesystem. |
|
mongodb
Package mongodb provides MongoDB clients, instance-scoped connection management, OpenTelemetry instrumentation and generic repositories.
|
Package mongodb provides MongoDB clients, instance-scoped connection management, OpenTelemetry instrumentation and generic repositories. |
|
orm
Package orm provides instance-scoped GORM clients, bounded repositories and explicit transaction scopes.
|
Package orm provides instance-scoped GORM clients, bounded repositories and explicit transaction scopes. |
|
orm/backend
Package backend defines the instance-scoped contract between ORM cores and SQL adapters.
|
Package backend defines the instance-scoped contract between ORM cores and SQL adapters. |
|
orm/backend/mysql
Package mysql supports Oracle MySQL 8.4 LTS with InnoDB tables.
|
Package mysql supports Oracle MySQL 8.4 LTS with InnoDB tables. |
|
orm/backend/postgres
Package postgres supports PostgreSQL 16–18 using the GORM pgx driver.
|
Package postgres supports PostgreSQL 16–18 using the GORM pgx driver. |
|
orm/backend/sqlite
Package sqlite supports SQLite via glebarez's pure-Go driver.
|
Package sqlite supports SQLite via glebarez's pure-Go driver. |
|
Package eventbus provides transport-independent task queues and publish-subscribe event processing.
|
Package eventbus provides transport-independent task queues and publish-subscribe event processing. |
|
contracttest
Package contracttest provides reusable behavioral checks for the public EventBus contract over real transports.
|
Package contracttest provides reusable behavioral checks for the public EventBus contract over real transports. |
|
driver/kafka
Package kafka implements the EventBus transport using Apache Kafka.
|
Package kafka implements the EventBus transport using Apache Kafka. |
|
driver/memory
Package memory implements an in-process EventBus transport for local use and testing.
|
Package memory implements an in-process EventBus transport for local use and testing. |
|
driver/nats
Package nats implements the EventBus transport using NATS JetStream.
|
Package nats implements the EventBus transport using NATS JetStream. |
|
driver/redis
Package redis implements the EventBus transport using Redis Streams.
|
Package redis implements the EventBus transport using Redis Streams. |
|
registry
Package registry registers named factories for constructing EventBus transports.
|
Package registry registers named factories for constructing EventBus transports. |
|
transport
Package transport defines the contracts, capabilities, topology, and delivery types used by EventBus drivers.
|
Package transport defines the contracts, capabilities, topology, and delivery types used by EventBus drivers. |
|
transport/contracttest
Package contracttest provides reusable behavioral checks for EventBus transports.
|
Package contracttest provides reusable behavioral checks for EventBus transports. |
|
examples
|
|
|
auth
command
Package main demonstrates policy-driven JWT issuance, encrypted token binding, generic Redis sessions, revocation, key rotation, and HTTP authentication middleware.
|
Package main demonstrates policy-driven JWT issuance, encrypted token binding, generic Redis sessions, revocation, key rotation, and HTTP authentication middleware. |
|
cache
command
Package main demonstrates memory and Redis caching, JSON helpers, and distributed locks.
|
Package main demonstrates memory and Redis caching, JSON helpers, and distributed locks. |
|
config
command
Package main demonstrates loading typed configuration from YAML files and environment variables.
|
Package main demonstrates loading typed configuration from YAML files and environment variables. |
|
cron
command
Package main demonstrates local and distributed scheduled jobs.
|
Package main demonstrates local and distributed scheduled jobs. |
|
db
command
Package main demonstrates GORM repositories, pagination, transactions, joins, and SQL migrations.
|
Package main demonstrates GORM repositories, pagination, transactions, joins, and SQL migrations. |
|
db_mongodb
command
Package main runs self-cleaning MongoDB examples: client groups, CRUD, indexed pagination, streaming, cross-database transactions with an outbox, scope guards, change streams, capability/diagnostic checks, driver options, transaction monitoring, and graceful draining.
|
Package main runs self-cleaning MongoDB examples: client groups, CRUD, indexed pagination, streaming, cross-database transactions with an outbox, scope guards, change streams, capability/diagnostic checks, driver options, transaction monitoring, and graceful draining. |
|
eventbus
command
Package main demonstrates EventBus tasks and events in a single process.
|
Package main demonstrates EventBus tasks and events in a single process. |
|
eventbus/admin
command
Package main provides an EventBus operations example for statistics and dead-letter queue administration.
|
Package main provides an EventBus operations example for statistics and dead-letter queue administration. |
|
eventbus/benchmark
command
Package main benchmarks EventBus throughput, latency, retries, and concurrency across supported transports.
|
Package main benchmarks EventBus throughput, latency, retries, and concurrency across supported transports. |
|
eventbus/internal/demo
Package demo contains shared configuration, runtime wiring, handlers, and observability helpers for EventBus examples.
|
Package demo contains shared configuration, runtime wiring, handlers, and observability helpers for EventBus examples. |
|
eventbus/observability
command
Package main demonstrates EventBus metrics and tracing with OpenTelemetry.
|
Package main demonstrates EventBus metrics and tracing with OpenTelemetry. |
|
eventbus/producer
command
Package main demonstrates publishing EventBus tasks and events from a standalone producer.
|
Package main demonstrates publishing EventBus tasks and events from a standalone producer. |
|
eventbus/subscriber
command
Package main demonstrates consuming EventBus broadcast events in a standalone subscriber.
|
Package main demonstrates consuming EventBus broadcast events in a standalone subscriber. |
|
eventbus/worker
command
Package main demonstrates processing EventBus tasks in a standalone worker.
|
Package main demonstrates processing EventBus tasks in a standalone worker. |
|
foundation
command
Package main demonstrates supervised APIs, workers, dependencies, health checks, telemetry, and graceful shutdown with foundation.App.
|
Package main demonstrates supervised APIs, workers, dependencies, health checks, telemetry, and graceful shutdown with foundation.App. |
|
graphql
command
Package main demonstrates serving a gqlgen GraphQL API with net/http, Fiber, Gin, and Echo adapters.
|
Package main demonstrates serving a gqlgen GraphQL API with net/http, Fiber, Gin, and Echo adapters. |
|
graphql/graph
Package graph contains the generated GraphQL executable schema and its resolver implementations.
|
Package graph contains the generated GraphQL executable schema and its resolver implementations. |
|
graphql/graph/model
Package model contains generated data types for the GraphQL example schema.
|
Package model contains generated data types for the GraphQL example schema. |
|
graphql/service
Package service provides the in-memory data and batch-loading functions used by the GraphQL example.
|
Package service provides the in-memory data and batch-loading functions used by the GraphQL example. |
|
grpc/cmd/certgen
command
Command certgen creates development-only TLS/mTLS certificates for localhost.
|
Command certgen creates development-only TLS/mTLS certificates for localhost. |
|
grpc/cmd/client
command
Command client exercises unary, streaming, error, deadline and health scenarios.
|
Command client exercises unary, streaming, error, deadline and health scenarios. |
|
grpc/cmd/foundation
command
Command foundation runs the gRPC example with foundation-owned signals/lifecycle.
|
Command foundation runs the gRPC example with foundation-owned signals/lifecycle. |
|
grpc/cmd/server
command
Command server runs the authenticated gRPC demonstration server.
|
Command server runs the authenticated gRPC demonstration server. |
|
grpc/internal/demo
Package demo contains the wiring shared by the standalone server and client.
|
Package demo contains the wiring shared by the standalone server and client. |
|
grpc/internal/devcert
Package devcert creates short-lived localhost certificates for this example.
|
Package devcert creates short-lived localhost certificates for this example. |
|
grpc/proto
Package proto contains generated protobuf messages and services for the gRPC echo example.
|
Package proto contains generated protobuf messages and services for the gRPC echo example. |
|
health
command
Package main demonstrates readiness and liveness endpoints with framework-specific health handlers.
|
Package main demonstrates readiness and liveness endpoints with framework-specific health handlers. |
|
httpclient
command
Package main demonstrates HTTP retries and circuit breaking with the resilient HTTP client.
|
Package main demonstrates HTTP retries and circuit breaking with the resilient HTTP client. |
|
kafka
command
Package main demonstrates basic usage of the github.com/thanhbvha/go-common/kafka package.
|
Package main demonstrates basic usage of the github.com/thanhbvha/go-common/kafka package. |
|
logger
command
Package main demonstrates synchronous, asynchronous, contextual, and child structured loggers.
|
Package main demonstrates synchronous, asynchronous, contextual, and child structured loggers. |
|
nats
command
Package main demonstrates NATS messaging, JetStream, consumer groups, key-value storage, and JSON helpers.
|
Package main demonstrates NATS messaging, JetStream, consumer groups, key-value storage, and JSON helpers. |
|
ratelimit
command
Package main demonstrates Redis-backed rate limiting through HTTP framework middleware.
|
Package main demonstrates Redis-backed rate limiting through HTTP framework middleware. |
|
recovery
command
Package main demonstrates framework-independent panic capture and structured recovery reports.
|
Package main demonstrates framework-independent panic capture and structured recovery reports. |
|
redis
command
Package main demonstrates Redis clients in standalone, cluster, and Sentinel modes.
|
Package main demonstrates Redis clients in standalone, cluster, and Sentinel modes. |
|
telemetry
command
Package main demonstrates OpenTelemetry tracing and metrics instrumentation.
|
Package main demonstrates OpenTelemetry tracing and metrics instrumentation. |
|
utils
command
Package main demonstrates cryptography, strings, context keys, slices, maps, and graceful shutdown utilities.
|
Package main demonstrates cryptography, strings, context keys, slices, maps, and graceful shutdown utilities. |
|
web
command
Package main demonstrates a validated HTTP API with standardized responses and middleware.
|
Package main demonstrates a validated HTTP API with standardized responses and middleware. |
|
websocket
command
Package main demonstrates an authenticated WebSocket server with rooms, sharding, clustering, and graceful shutdown.
|
Package main demonstrates an authenticated WebSocket server with rooms, sharding, clustering, and graceful shutdown. |
|
websocket/client
command
Package main provides an interactive and scripted client for the WebSocket server example.
|
Package main provides an interactive and scripted client for the WebSocket server example. |
|
websocket/cluster
command
The cluster example separates gateways, business workers and realtime routers.
|
The cluster example separates gateways, business workers and realtime routers. |
|
websocket/internal/exampleconfig
Package exampleconfig loads shared YAML, dotenv, environment, and command-line configuration for WebSocket examples.
|
Package exampleconfig loads shared YAML, dotenv, environment, and command-line configuration for WebSocket examples. |
|
websocket/loadtest
command
Package main provides a configurable load generator for the WebSocket server example.
|
Package main provides a configurable load generator for the WebSocket server example. |
|
xerrors
command
Package main demonstrates structured errors, wrapping, joining, stack traces, and attached fields.
|
Package main demonstrates structured errors, wrapping, joining, stack traces, and attached fields. |
|
Package foundation provides a supervised application lifecycle for Go services.
|
Package foundation provides a supervised application lifecycle for Go services. |
|
adapter/fiber
Package fiber adapts Fiber applications to foundation components.
|
Package fiber adapts Fiber applications to foundation components. |
|
adapter/grpc
Package grpc adapts gRPC servers to foundation components.
|
Package grpc adapts gRPC servers to foundation components. |
|
adapter/nethttp
Package nethttp adapts net/http servers to foundation components.
|
Package nethttp adapts net/http servers to foundation components. |
|
Package graphql provides a bounded, framework-independent gqlgen HTTP server.
|
Package graphql provides a bounded, framework-independent gqlgen HTTP server. |
|
adapter/echo
Package echoadapter adapts the GraphQL core HTTP handler to Echo.
|
Package echoadapter adapts the GraphQL core HTTP handler to Echo. |
|
adapter/fiber
Package fiberadapter adapts the GraphQL core HTTP handler to Fiber.
|
Package fiberadapter adapts the GraphQL core HTTP handler to Fiber. |
|
adapter/gin
Package ginadapter adapts the GraphQL core HTTP handler to Gin.
|
Package ginadapter adapts the GraphQL core HTTP handler to Gin. |
|
Package grpc provides reusable gRPC client and server configuration with logging, recovery, errors, and telemetry plumbing.
|
Package grpc provides reusable gRPC client and server configuration with logging, recovery, errors, and telemetry plumbing. |
|
interceptors
Package interceptors provides gRPC server interceptors for error mapping, logging, and panic recovery.
|
Package interceptors provides gRPC server interceptors for error mapping, logging, and panic recovery. |
|
Package health provides HTTP health check endpoints for microservices.
|
Package health provides HTTP health check endpoints for microservices. |
|
handler/echo
Package echohealth exposes health check handlers for Echo.
|
Package echohealth exposes health check handlers for Echo. |
|
handler/fiber
Package fiberhealth exposes health check handlers for Fiber.
|
Package fiberhealth exposes health check handlers for Fiber. |
|
handler/gin
Package ginhealth exposes health check handlers for Gin.
|
Package ginhealth exposes health check handlers for Gin. |
|
handler/nethttp
Package nethttp provides health check handlers for the standard library's net/http package.
|
Package nethttp provides health check handlers for the standard library's net/http package. |
|
Package httpclient provides a resilient HTTP client wrapper around go-resty.
|
Package httpclient provides a resilient HTTP client wrapper around go-resty. |
|
internal
|
|
|
httpkit
Package httpkit contains internal, framework-independent HTTP primitives shared by the repository's net/http adapters.
|
Package httpkit contains internal, framework-independent HTTP primitives shared by the repository's net/http adapters. |
|
Package kafka provides a production-ready Apache Kafka client wrapper built on top of github.com/twmb/franz-go.
|
Package kafka provides a production-ready Apache Kafka client wrapper built on top of github.com/twmb/franz-go. |
|
Package logger provides a structured, asynchronous logger built on top of the standard library's log/slog.
|
Package logger provides a structured, asynchronous logger built on top of the standard library's log/slog. |
|
middleware/echo
Package echolog provides request ID and access logging middleware for Echo.
|
Package echolog provides request ID and access logging middleware for Echo. |
|
middleware/fiber
Package fiberlog provides request ID and access logging middleware for Fiber.
|
Package fiberlog provides request ID and access logging middleware for Fiber. |
|
middleware/gin
Package ginlog provides request ID and access logging middleware for Gin.
|
Package ginlog provides request ID and access logging middleware for Gin. |
|
middleware/nethttp
Package nethttplog provides request ID and access logging middleware for the standard library's net/http package.
|
Package nethttplog provides request ID and access logging middleware for the standard library's net/http package. |
|
Package nats provides a production-ready NATS client wrapper built on top of github.com/nats-io/nats.go.
|
Package nats provides a production-ready NATS client wrapper built on top of github.com/nats-io/nats.go. |
|
Package ratelimit provides a distributed rate limiter backed by Redis.
|
Package ratelimit provides a distributed rate limiter backed by Redis. |
|
middleware/echo
Package echolimit provides rate limiting middleware for Echo.
|
Package echolimit provides rate limiting middleware for Echo. |
|
middleware/fiber
Package fiberlimit provides rate limiting middleware for Fiber.
|
Package fiberlimit provides rate limiting middleware for Fiber. |
|
middleware/gin
Package ginlimit provides rate limiting middleware for Gin.
|
Package ginlimit provides rate limiting middleware for Gin. |
|
middleware/nethttp
Package nethttplimit provides rate limiting middleware for the standard library's net/http package.
|
Package nethttplimit provides rate limiting middleware for the standard library's net/http package. |
|
Package recovery captures panics as structured, framework-independent reports.
|
Package recovery captures panics as structured, framework-independent reports. |
|
Package redis provides a production-ready Redis client wrapper built on top of github.com/redis/go-redis/v9.
|
Package redis provides a production-ready Redis client wrapper built on top of github.com/redis/go-redis/v9. |
|
Package telemetry provides production-ready OpenTelemetry integration.
|
Package telemetry provides production-ready OpenTelemetry integration. |
|
utils
|
|
|
crypt
Package crypt provides modern, secure cryptographic utilities.
|
Package crypt provides modern, secure cryptographic utilities. |
|
ctxkey
Package ctxkey provides a strongly-typed mechanism for managing context keys.
|
Package ctxkey provides a strongly-typed mechanism for managing context keys. |
|
graceful
Package graceful provides utilities for graceful shutdown of services.
|
Package graceful provides utilities for graceful shutdown of services. |
|
maps
Package maps provides generic utility functions for Go maps.
|
Package maps provides generic utility functions for Go maps. |
|
slice
Package slice provides generic utility functions for Go slices.
|
Package slice provides generic utility functions for Go slices. |
|
str
Package str provides utility functions for common string manipulation tasks.
|
Package str provides utility functions for common string manipulation tasks. |
|
web
|
|
|
middleware/echo
Package echomw provides recovery, telemetry, and error middleware for Echo.
|
Package echomw provides recovery, telemetry, and error middleware for Echo. |
|
middleware/fiber
package fibermw provides standard HTTP middlewares for the Fiber web framework.
|
package fibermw provides standard HTTP middlewares for the Fiber web framework. |
|
middleware/gin
Package ginmw provides recovery, telemetry, and error middleware for Gin.
|
Package ginmw provides recovery, telemetry, and error middleware for Gin. |
|
middleware/internal/recoveryhttp
Package recoveryhttp contains framework-neutral HTTP policy shared by the standard net/http, Fiber, Gin, and Echo panic-recovery adapters.
|
Package recoveryhttp contains framework-neutral HTTP policy shared by the standard net/http, Fiber, Gin, and Echo panic-recovery adapters. |
|
middleware/nethttp
Package nethttpmw provides panic recovery and OpenTelemetry middleware for the standard library's net/http package.
|
Package nethttpmw provides panic recovery and OpenTelemetry middleware for the standard library's net/http package. |
|
response
Package response provides a standardized JSON response structure for API endpoints.
|
Package response provides a standardized JSON response structure for API endpoints. |
|
response/echo
Package echoresp writes standardized API responses for Echo.
|
Package echoresp writes standardized API responses for Echo. |
|
response/fiber
Package fiberresp writes standardized API responses for Fiber.
|
Package fiberresp writes standardized API responses for Fiber. |
|
response/gin
Package ginresp writes standardized API responses for Gin.
|
Package ginresp writes standardized API responses for Gin. |
|
response/nethttp
Package nethttp writes standardized API responses with the standard library's net/http package.
|
Package nethttp writes standardized API responses with the standard library's net/http package. |
|
validator
Package validator provides struct validation using github.com/go-playground/validator.
|
Package validator provides struct validation using github.com/go-playground/validator. |
|
websocket
|
|
|
adapter/echo
Package echo provides an adapter to bridge the Echo web framework and our generic WebSocket core.
|
Package echo provides an adapter to bridge the Echo web framework and our generic WebSocket core. |
|
adapter/fiber
Package fiber provides an adapter to bridge the Fiber web framework and our generic WebSocket core.
|
Package fiber provides an adapter to bridge the Fiber web framework and our generic WebSocket core. |
|
adapter/gin
Package gin provides an adapter to bridge the Gin web framework and our generic WebSocket core.
|
Package gin provides an adapter to bridge the Gin web framework and our generic WebSocket core. |
|
adapter/internal/wshttp
Package wshttp contains framework-neutral HTTP policy shared by WebSocket adapters.
|
Package wshttp contains framework-neutral HTTP policy shared by WebSocket adapters. |
|
adapter/nethttp
Package nethttp provides a WebSocket adapter for the standard library's net/http package.
|
Package nethttp provides a WebSocket adapter for the standard library's net/http package. |
|
core
package core contains the core WebSocket hub, connection lifecycle, and manager logic.
|
package core contains the core WebSocket hub, connection lifecycle, and manager logic. |
|
integration/eventbus
Package eventbus bridges the existing EventBus and realtime routing.
|
Package eventbus bridges the existing EventBus and realtime routing. |
|
internal/wsrecovery
Package wsrecovery centralizes structured panic reporting for WebSocket runtime goroutines.
|
Package wsrecovery centralizes structured panic reporting for WebSocket runtime goroutines. |
|
limiter
Package limiter provides token-bucket rate limiting tailored for WebSocket connections.
|
Package limiter provides token-bucket rate limiting tailored for WebSocket connections. |
|
pool
Package pool provides memory and concurrency pools to optimize resource usage under high traffic.
|
Package pool provides memory and concurrency pools to optimize resource usage under high traffic. |
|
pubsub
Package pubsub provides a distributed publish-subscribe abstraction for the WebSocket server.
|
Package pubsub provides a distributed publish-subscribe abstraction for the WebSocket server. |
|
pubsub/nats
Package natspubsub coordinates WebSocket nodes through NATS publish-subscribe messaging.
|
Package natspubsub coordinates WebSocket nodes through NATS publish-subscribe messaging. |
|
pubsub/redis
package redispubsub handles multi-node coordination using Redis pub/sub to route messages in a clustered environment.
|
package redispubsub handles multi-node coordination using Redis pub/sub to route messages in a clustered environment. |
|
routing
Package routing provides opt-in, tenant-scoped realtime routing.
|
Package routing provides opt-in, tenant-scoped realtime routing. |
|
routing/contracttest
Package contracttest contains the common registry/transport behavior suite.
|
Package contracttest contains the common registry/transport behavior suite. |
|
routing/nats
Package nats provides targeted best-effort NATS Core delivery with gateway results.
|
Package nats provides targeted best-effort NATS Core delivery with gateway results. |
|
routing/redis
Package redis provides Redis session leases and targeted Pub/Sub delivery.
|
Package redis provides Redis session leases and targeted Pub/Sub delivery. |
|
Package xerrors provides a structured error handling mechanism for HTTP applications.
|
Package xerrors provides a structured error handling mechanism for HTTP applications. |
Click to show internal directories.
Click to hide internal directories.