Skip to content

[Proposal] Add typed getters for Context values #2770

@SebastianOsuna

Description

@SebastianOsuna

To easily access context typed values, would you consider adding typed getters?

userID := ctx.GetInt64("userId")

This of course would be a breaking change since a bunch of new functions would be added to the Context interface.

We've created an extension to handle such typed getters:

https://github.com/BacoFoods/echoext/blob/master/context.go#L12

I'd be willing to port it to the main project, but I'd like to pick your brains as to the value of this in echo before commiting to a PR.

*Example Use Case: * passing auth parameters from an auth middleware down to handlers.\

Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions