afterwork

command
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

afterwork + handler 示例:声明式 handler + 响应后副作用。

演示 waitUntil 语义在 beauty 的落地:

  • POST /order:用 pkg/handler 声明式包装(auth + inject + afterwork), handler 返回响应后,afterwork.Defer 投递的"发邮件/写审计"在响应返回后跑完;
  • GET /health:无 body、无 auth 的极简 handler。

跑:go run ./examples/afterwork 验证:curl -XPOST localhost:8303/order -d '{"sku":"A","qty":2}'

服务端日志会看到"response sent"先于"audit written"。

Jump to

Keyboard shortcuts

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