gateway

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gateway 是示例消费方模块:经契约边界调用 greet 域。 它只 import greetapi——拿到本地实现还是远程 client 由组合根的 target/Remote 配置决定,本包代码在两种形态下一行不改。

Index

Constants

View Source
const Pattern = "GET /hello/{name}"

Pattern 是本模块唯一路由。导出供测试挂载同一 pattern。

Variables

This section is empty.

Functions

func Module

func Module(log *slog.Logger) appkit.Module

Module 返回 gateway 模块。

func NewHandler

func NewHandler(log *slog.Logger, svc greetapi.Service) http.Handler

NewHandler 返回 /hello 处理器。svc 由组合根装配:本地形态是 greetapi.WrapService 包的实现,远程形态是 greetapi.NewClient—— 两者的契约边界四件套(守卫/防火墙/超时/错误规范化)都已在方法体内, 本函数裸调即可,两种形态一行不改。

Types

This section is empty.

Jump to

Keyboard shortcuts

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