util

package
v0.0.0-...-a1716bb Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCookie

func AddCookie(w *http.ResponseWriter, name string, value string)

AddCookie will apply a new cookie to the response of a http request, with the key/value this method is passed.

func ClearCookie

func ClearCookie(w *http.ResponseWriter, name string)

func GenerateRandomString

func GenerateRandomString(length int) string

GenerateRandomString generates a random string containing numbers and letters

func GetUsernameByRequestCookieID

func GetUsernameByRequestCookieID(r *http.Request) (username string, found bool)

func LoggingSetup

func LoggingSetup(logFileName string)

func ReadSpotifyAuthData

func ReadSpotifyAuthData() (clientID string, clientSecret string, err error)

func RenderErrorView

func RenderErrorView(w http.ResponseWriter, username string, title string, status int, message string)

func RenderSpAPIErrorView

func RenderSpAPIErrorView(w http.ResponseWriter, username string, title string, apiErr *models.SpAPIError)

func RenderView

func RenderView(w http.ResponseWriter, page string, viewData interface{})

templates cheatsheet https://curtisvermeeren.github.io/2017/09/14/Golang-Templates-Cheatsheet

func SendAPIErrorResp

func SendAPIErrorResp(w io.Writer, message string, status int)

func SendAPIOKResp

func SendAPIOKResp(w io.Writer, message string)

func SendAPIOKRespWithData

func SendAPIOKRespWithData(w io.Writer, message string, data interface{})

func SendAPIResp

func SendAPIResp(w io.Writer, data interface{})

func SetupTemplates

func SetupTemplates()

Types

This section is empty.

Jump to

Keyboard shortcuts

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