-
Notifications
You must be signed in to change notification settings - Fork 59
/
auth0.go
80 lines (68 loc) · 1.59 KB
/
auth0.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package auth0
import (
"fmt"
"time"
)
// Bool returns a pointer to the bool value passed in.
func Bool(b bool) *bool { return &b }
// BoolValue returns the value of the bool pointer passed in or false if the
// pointer is nil.
func BoolValue(b *bool) bool {
if b != nil {
return *b
}
return false
}
// Int returns a pointer to the int value passed in.
func Int(i int) *int {
return &i
}
// IntValue returns the value of the int pointer passed in or 0 if the pointer
// is nil.
func IntValue(i *int) int {
if i != nil {
return *i
}
return 0
}
// Float64 returns a pointer to the float64 value passed in.
func Float64(f float64) *float64 {
return &f
}
// Float64Value returns the value of the float64 pointer passed in or 0 if the pointer
// is nil.
func Float64Value(f *float64) float64 {
if f != nil {
return *f
}
return 0.00
}
// String returns a pointer to the string value passed in.
func String(s string) *string {
return &s
}
// Stringf returns a pointer to the string value passed in formatted using
// fmt.Sprintf.
func Stringf(s string, v ...interface{}) *string {
return String(fmt.Sprintf(s, v...))
}
// StringValue returns the value of the string pointer passed in or "" if the
// pointer is nil.
func StringValue(v *string) string {
if v != nil {
return *v
}
return ""
}
// Time returns a pointer to the time value passed in.
func Time(t time.Time) *time.Time {
return &t
}
// TimeValue returns the value of the time pointer passed in or the zero value
// of time if the pointer is nil.
func TimeValue(t *time.Time) time.Time {
if t != nil {
return *t
}
return time.Time{}
}