Skip to content

v1.10.0 - Simplified Lifecycle Handler API

Latest

Choose a tag to compare

@RobertWHurst RobertWHurst released this 26 Oct 06:31
· 38 commits to master since this release

This release simplifies the API for open and close lifecycle handlers, making them more intuitive and less error-prone.

What's New

Automatic Handler Progression

• Open and close handlers now automatically progress through the chain without requiring ctx.Next() calls
• Reduces boilerplate and prevents common mistakes where developers forget to call Next()
• Handlers can still explicitly call ctx.Next() for advanced post-processing patterns

OpenHandler and CloseHandler Interfaces

• New interfaces allow middleware to automatically register lifecycle hooks
• When a handler implementing these interfaces is registered via Use(), its HandleOpen and HandleClose methods are automatically registered as lifecycle
handlers
• Simplifies complex middleware that needs to hook into connection initialization and cleanup

Improved Documentation

• Clearer explanations of lifecycle handler behavior
• Added examples of post-processing patterns
• More concise sections throughout the README

Breaking Changes

None - this is a backward compatible change. Existing code that calls ctx.Next() in open/close handlers will continue to work.