utils

package
v0.0.0-...-0ca455c Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const AdminPenaltyLookupRole = "/admin/penalty-lookup"

AdminPenaltyLookupRole defines the path to check whether a user is authorised to look up a penalty.

Variables

This section is empty.

Functions

func GenerateEtag

func GenerateEtag() (string, error)

GenerateEtag generates a random etag which is generated on every write action

func GenerateReferenceNumber

func GenerateReferenceNumber() string

GenerateReferenceNumber produces a random reference number in the format of [A-Z]{2}[0-9]{8}

func GetCompanyNumberFromVars

func GetCompanyNumberFromVars(vars map[string]string) (string, error)

GetCompanyNumberFromVars returns the company number from the supplied request vars.

func WriteJSON

func WriteJSON(w http.ResponseWriter, r *http.Request, data interface{})

WriteJSON writes the interface as a json string with status of 200.

func WriteJSONWithStatus

func WriteJSONWithStatus(w http.ResponseWriter, r *http.Request, data interface{}, status int)

WriteJSONWithStatus writes the interface as a json string with the supplied status.

Types

This section is empty.

Jump to

Keyboard shortcuts

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