framework

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	// contains filtered or unexported fields
}

Application 是框架运行时的最小持有者。

中文说明:

  • Application 的职责非常克制:只负责持有一个 Container。
  • 这样做的目的,是把”框架启动时需要共享的根对象”收敛到一个地方, 避免后续各类 provider、命令入口、业务模块直接散落依赖具体实现。
  • 后续如果要扩展全局生命周期(例如 shutdown hook、全局 event bus、统一 runtime 状态), 可以继续挂在 Application 上,而不需要改变外部调用方式。

设计上,Application 本身不直接负责: - 注册 provider - 启动 HTTP/gRPC/Cron - 读取配置 这些工作都在上层 bootstrap / cmd 层完成。

func NewApplication

func NewApplication() *Application

NewApplication 创建一个新的框架运行时实例。

中文说明:

  • 该函数会同时创建默认容器实现 `container.New()`。
  • 容器在创建时会把“容器自己”绑定到 `contract.ContainerKey`, 因此后续 factory/provider 内部也能反向取回 container 本身。
  • 当前函数不做任何 provider 注册,返回的 Application 只是一个“空运行时骨架”。

func (*Application) Container

func (a *Application) Container() runtimecontract.Container

Container 返回当前运行时持有的依赖注入容器。

中文说明: - 上层通常通过这个入口继续注册 provider 或解析服务。 - 这里不返回具体实现 `*container.Container`,是为了尽量让外部只依赖 contract。

Directories

Path Synopsis
Package application provides application startup entrypoints for gorp framework.
Package application provides application startup entrypoints for gorp framework.
Package bootstrap provides framework bootstrap and assembly helpers for gorp.
Package bootstrap provides framework bootstrap and assembly helpers for gorp.
Package container provides runtime dependency injection container for gorp framework.
Package container provides runtime dependency injection container for gorp framework.
contract
data
Application scenarios: - Define the cache contract used by business services and framework providers.
Application scenarios: - Define the cache contract used by business services and framework providers.
discovery
Application scenarios: - Define the service-instance selection contract used by discovery-aware RPC clients.
Application scenarios: - Define the service-instance selection contract used by discovery-aware RPC clients.
integration
Application scenarios: - Define the distributed transaction contract used by business orchestration flows.
Application scenarios: - Define the distributed transaction contract used by business orchestration flows.
observability
Application scenarios: - Define health check contracts for services and their dependencies.
Application scenarios: - Define health check contracts for services and their dependencies.
resilience
Application scenarios: - Define the shared governance-mode and policy-provider contracts used by bootstrap and runtime assembly.
Application scenarios: - Define the shared governance-mode and policy-provider contracts used by bootstrap and runtime assembly.
runtime
Application scenarios: - Define minimal business-facing runtime contracts shared across framework layers.
Application scenarios: - Define minimal business-facing runtime contracts shared across framework layers.
security
Application scenarios: - Define the business-facing JWT authentication contract used by handlers and services.
Application scenarios: - Define the business-facing JWT authentication contract used by handlers and services.
support
Application scenarios: - Attach the runtime container onto request-scoped or task-scoped contexts.
Application scenarios: - Attach the runtime container onto request-scoped or task-scoped contexts.
transport
Application scenarios: - Define the framework-agnostic HTTP request context contract.
Application scenarios: - Define the framework-agnostic HTTP request context contract.
Package deploy provides deployment utilities for gorp framework.
Package deploy provides deployment utilities for gorp framework.
Package goroutine provides goroutine safety utilities for gorp framework.
Package goroutine provides goroutine safety utilities for gorp framework.
grpc
interceptor
Application scenarios: - Provide one provider-neutral home for the framework's gRPC governance interceptor presets.
Application scenarios: - Provide one provider-neutral home for the framework's gRPC governance interceptor presets.
http
middleware
Application scenarios: - Record operator, resource, action, and outcome for business-sensitive endpoints.
Application scenarios: - Record operator, resource, action, and outcome for business-sensitive endpoints.
Package httpx provides HTTP utilities for gorp framework.
Package httpx provides HTTP utilities for gorp framework.
Package lifecycle provides service lifecycle management for gorp framework.
Package lifecycle provides service lifecycle management for gorp framework.
Package log provides lightweight logging utilities for gorp framework.
Package log provides lightweight logging utilities for gorp framework.
provider
app
Package app provides application root-path capability for gorp framework.
Package app provides application root-path capability for gorp framework.
auth/jwt
Package jwt provides Gin HTTP middleware for JWT authentication.
Package jwt provides Gin HTTP middleware for JWT authentication.
cache
Package cache provides in-memory cache implementation.
Package cache provides in-memory cache implementation.
config
Package config provides environment normalization utilities for gorp framework.
Package config provides environment normalization utilities for gorp framework.
configsource/local
Package local provides local file config source implementation for gorp framework.
Package local provides local file config source implementation for gorp framework.
configsource/noop
Package noop provides a no-op config source for monolith scenarios.
Package noop provides a no-op config source for monolith scenarios.
cron
Package cron provides cron scheduling service for gorp framework.
Package cron provides cron scheduling service for gorp framework.
discovery/noop
Package noop provides a no-op service discovery registry for monolith scenarios.
Package noop provides a no-op service discovery registry for monolith scenarios.
dlock/noop
Package noop provides a no-op distributed lock for monolith scenarios.
Package noop provides a no-op distributed lock for monolith scenarios.
dtm/noop
Package noop provides a no-op DTM distributed transaction client for monolith scenarios.
Package noop provides a no-op DTM distributed transaction client for monolith scenarios.
error_reporter
Package error_reporter provides error reporting service for gorp framework.
Package error_reporter provides error reporting service for gorp framework.
errors/std
Package std provides standard error handling implementation for gorp framework.
Package std provides standard error handling implementation for gorp framework.
event
Package event provides local in-memory event bus implementation for gorp framework.
Package event provides local in-memory event bus implementation for gorp framework.
gin
Package gin provides Gin-based HTTP server implementation for gorp framework.
Package gin provides Gin-based HTTP server implementation for gorp framework.
grpc
Package grpc provides gRPC interceptors for gorp framework.
Package grpc provides gRPC interceptors for gorp framework.
health
Package health provides dependency health checkers for common components.
Package health provides dependency health checkers for common components.
host
Package host provides service adapters for wrapping HTTP, Cron, and GRPC servers.
Package host provides service adapters for wrapping HTTP, Cron, and GRPC servers.
loadshedding
Package loadshedding 提供过载保护(LoadShedding)实现。
Package loadshedding 提供过载保护(LoadShedding)实现。
loadshedding/bbr
Package bbr 提供 BBR 自适应过载保护实现。
Package bbr 提供 BBR 自适应过载保护实现。
loadshedding/noop
Package noop 提供 LoadShedding 的空实现。
Package noop 提供 LoadShedding 的空实现。
log
Package log provides zap-based logging service for gorp framework.
Package log provides zap-based logging service for gorp framework.
messagequeue/noop
Package noop provides a no-op message queue for monolith scenarios.
Package noop provides a no-op message queue for monolith scenarios.
metadata
Package metadata provides metadata propagation service for gorp framework.
Package metadata provides metadata propagation service for gorp framework.
metadata/middleware
Package middleware provides gRPC metadata propagation middleware.
Package middleware provides gRPC metadata propagation middleware.
metadata/noop
Package noop provides no-op metadata implementation for monolith scenarios.
Package noop provides no-op metadata implementation for monolith scenarios.
metadata/propagator
Package propagator provides metadata propagation implementation for gorp framework.
Package propagator provides metadata propagation implementation for gorp framework.
observability
Package observability provides observability service implementation for gorp framework.
Package observability provides observability service implementation for gorp framework.
orm/ent
Package ent provides Ent ORM integration for gorp framework.
Package ent provides Ent ORM integration for gorp framework.
orm/gorm
Package gorm provides a custom GORM logger implementation.
Package gorm provides a custom GORM logger implementation.
orm/inspect
Package inspect provides database schema inspection service.
Package inspect provides database schema inspection service.
orm/runtime
Package runtime provides ORM backend abstraction and unified runtime services.
Package runtime provides ORM backend abstraction and unified runtime services.
orm/sqlx
Package sqlx provides SQLX ORM integration for gorp framework.
Package sqlx provides SQLX ORM integration for gorp framework.
outbox
Package outbox provides in-memory outbox pattern implementation for gorp framework.
Package outbox provides in-memory outbox pattern implementation for gorp framework.
proto
Package proto provides proto generator implementation.
Package proto provides proto generator implementation.
ratelimiter
Package ratelimiter provides rate limiting capability for gorp framework.
Package ratelimiter provides rate limiting capability for gorp framework.
redis
Package redis provides Redis service for gorp framework.
Package redis provides Redis service for gorp framework.
retry
Package retry provides retry service for gorp framework.
Package retry provides retry service for gorp framework.
retry/noop
Application scenarios: - Provide the monolith-friendly no-op retry capability.
Application scenarios: - Provide the monolith-friendly no-op retry capability.
rpc/grpc
Package grpc provides the gRPC-based RPC client for the gorp framework.
Package grpc provides the gRPC-based RPC client for the gorp framework.
rpc/http
Package http provides HTTP RPC client for gorp framework.
Package http provides HTTP RPC client for gorp framework.
rpc/noop
Package noop provides a no-op RPC client/server for monolith scenarios.
Package noop provides a no-op RPC client/server for monolith scenarios.
selector/noop
Package noop provides a no-op load balancing selector for monolith scenarios.
Package noop provides a no-op load balancing selector for monolith scenarios.
selector/p2c
Package p2c provides Power of Two Choices load balancing selector.
Package p2c provides Power of Two Choices load balancing selector.
selector/random
Package random provides random load balancing selector for service discovery.
Package random provides random load balancing selector for service discovery.
selector/wrr
Package wrr provides weighted round-robin load balancing selector.
Package wrr provides weighted round-robin load balancing selector.
serviceauth/noop
Package noop provides a no-op service authenticator for monolith scenarios.
Package noop provides a no-op service authenticator for monolith scenarios.
ssh
Package ssh provides SSH service for gorp framework.
Package ssh provides SSH service for gorp framework.
tracing/middleware
Package middleware provides gRPC tracing middleware for gorp framework.
Package middleware provides gRPC tracing middleware for gorp framework.
tracing/noop
Package noop provides a no-op tracing implementation for monolith scenarios.
Package noop provides a no-op tracing implementation for monolith scenarios.
validate
Package validate provides a unified validation service using go-playground/validator.
Package validate provides a unified validation service using go-playground/validator.
validate/noop
Package noop provides a no-op validator implementation for monolith scenarios.
Package noop provides a no-op validator implementation for monolith scenarios.
websocket
Package websocket provides WebSocket capability provider for gorp framework.
Package websocket provides WebSocket capability provider for gorp framework.
websocket/noop
Package noop provides a no-op WebSocket service implementation for gorp.
Package noop provides a no-op WebSocket service implementation for gorp.
rpc
governance
Application scenarios: - Provide a shared outbound RPC governance chain model used by HTTP and gRPC clients.
Application scenarios: - Provide a shared outbound RPC governance chain model used by HTTP and gRPC clients.
Package testing provides testing utilities for gorp framework.
Package testing provides testing utilities for gorp framework.

Jump to

Keyboard shortcuts

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