middleware

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONFrom

func JSONFrom(key string) func(ctx *fiber.Ctx) error

JSONFrom middleware renders a JSON response from the provided ctx.Locals key

func WithBattle

func WithBattle(r battles.Reader) func(*fiber.Ctx) error

WithBattle middleware sets the battle corresponding to the :battleID URL parameter into ctx.Locals under the key "battle"

func WithBattles

func WithBattles(r battles.Reader) func(*fiber.Ctx) error

WithBattles middleware finds battles according to the optional :factionID or :commanderID URL parameters and the optional "page" query parameter (falling back to 1), and sets them into ctx.Locals under the key "battles". When present, it will also use the "name", "summary", "place" and "result" query parameters to refine this search

func WithCommander

func WithCommander(r commanders.Reader) func(*fiber.Ctx) error

WithCommander middleware sets the commander corresponding to the :commanderID URL parameter into ctx.Locals under the key "commander"

func WithCommanders

func WithCommanders(r commanders.Reader) func(*fiber.Ctx) error

WithCommanders middleware finds commanders according to the optional :factionID URL parameter and the optional "page" query parameter (falling back to 1), and sets them into ctx.Locals under the key "commanders". When present, it will also use the "name" and "summary" query parameters to refine this search

func WithFaction

func WithFaction(r factions.Reader) func(*fiber.Ctx) error

WithFaction middleware sets the faction corresponding to the :factionID URL parameter into ctx.Locals under the key "faction"

func WithFactions

func WithFactions(r factions.Reader) func(*fiber.Ctx) error

WithFactions middleware finds factions according to the optional :commanderID URL parameter and the optional "page" query parameter (falling back to 1), and sets them into ctx.Locals under the key "factions". When present, it will also use the "name" and "summary" query parameters to refine this search

func WithPage

func WithPage() func(*fiber.Ctx) error

WithPage middleware parses the optional "page" query parameter, validates it, and then stores its value into ctx.Locals under the key "page"

Types

This section is empty.

Jump to

Keyboard shortcuts

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