-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.go
41 lines (37 loc) · 1.29 KB
/
constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package magiclinksdev
import (
"errors"
"time"
)
const (
// ContentTypeJSON is the content type for JSON.
ContentTypeJSON = "application/json"
// DefaultOTPLength is the default length for OTPs.
DefaultOTPLength = 6
// DefaultRelativePathRedirect is the default relative path for redirecting.
DefaultRelativePathRedirect = "redirect"
// HeaderContentType is the content type header.
HeaderContentType = "Content-Type"
// LogFmt is the log format.
LogFmt = "%s\nError: %s"
// LogErr is the log error.
LogErr = "error"
// LogRequestBody is key for logging the request body.
LogRequestBody = "requestBody"
// LogResponseBody is key for logging the response body.
LogResponseBody = "responseBody"
// Over250Years is the maximum duration for this project. Restriction derived from Golang's time.Duration.
Over250Years = 250 * 366 * 24 * time.Hour
// ResponseInternalServerError is the response for internal server errors.
ResponseInternalServerError = "Internal server error."
// ResponseTooManyRequests is the response for too many requests.
ResponseTooManyRequests = "Too many requests."
// ResponseUnauthorized is the response for unauthorized requests.
ResponseUnauthorized = "Unauthorized."
)
var (
ErrParams = errors.New("invalid parameters")
)
func Ptr[T any](v T) *T {
return &v
}