util

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: LGPL-3.0 Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CryptoRandSeq

func CryptoRandSeq(n int) string

func FilterIncludes

func FilterIncludes[T comparable](src []T, list []T) []T

Returns all items from `src` that also occur in `list` in a slice.

func JSON

func JSON(w http.ResponseWriter, j interface{}, status int)

Marshals `j` and prints on `w` with `Content-Type: application/json`

func ParseForm

func ParseForm(w http.ResponseWriter, r *http.Request, out interface{}) bool

Unmarshals body of `r` as x-www-form-urlencoded to `&out`. If error, prints error to `w` and returns `false`.

func ParseJSON

func ParseJSON(w http.ResponseWriter, r *http.Request, out interface{}) bool

Unmarshals body of `r` as JSON to `&out`. If error, prints error to `w` and returns `false`.

func RandSeq

func RandSeq(n int) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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