Help us shape the future of Go! Take the 2026 Go Developer Survey

versioning

package
v1.11.9 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package versioning negotiates API versions and emits deprecation and sunset metadata. Applications own compatibility policy and migration communication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetVersion

func GetVersion(c *gpp.Context) string

GetVersion retrieves the negotiated API version from the context.

func Middleware

func Middleware(defaultVersion string) gpp.HandlerFunc

Middleware creates a package-level API versioning middleware for simple usage.

Types

type DeprecationInfo

type DeprecationInfo struct {
	SunsetDate string
}

DeprecationInfo describes the announced sunset date for an API version.

type Manager

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

Manager handles API version negotiation (Header, Query, Path) and RFC 8594 Deprecation/Sunset headers.

func NewManager

func NewManager(defaultVersion string) *Manager

NewManager initializes an API Versioning Manager.

func (*Manager) Deprecate

func (m *Manager) Deprecate(version string, sunsetDate string)

Deprecate marks an API version as deprecated with an RFC 8594 Sunset Date (e.g. "2027-01-01").

func (*Manager) Middleware

func (m *Manager) Middleware() gpp.HandlerFunc

Middleware returns API Versioning Middleware performing header negotiation and deprecation warnings.

Jump to

Keyboard shortcuts

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