1package main
2
3import (
4 "net/http"
5 "reflect"
6
7 "github.com/gofrs/uuid"
8 "github.com/tomwright/queryparam/v4"
9)
10
11func httpErr(w http.ResponseWriter, code int) {
12 http.Error(w, http.StatusText(code), code)
13}
14
15func stringPtr(s string) *string {
16 return &s
17}
18
19func init() {
20 queryparam.DefaultParser.ValueParsers[reflect.TypeOf(uuid.UUID{})] = func(value string, _ string) (reflect.Value, error) {
21 id, err := uuid.FromString(value)
22 return reflect.ValueOf(id), err
23 }
24}