-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
45 lines (36 loc) · 1.12 KB
/
types.go
File metadata and controls
45 lines (36 loc) · 1.12 KB
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
package ptr
import (
"go.chrisrx.dev/x/constraints"
)
// Int returns a int pointer value for the provided integer value.
func Int[T constraints.Integer](v T) *int {
return To(int(v))
}
// Int32 returns an int32 pointer value for the provided integer value.
func Int32[T constraints.Integer](v T) *int32 {
return To(int32(v))
}
// Int64 returns an int64 pointer value for the provided integer value.
func Int64[T constraints.Integer](v T) *int64 {
return To(int64(v))
}
// Uint returns a uint pointer value for the provided integer value.
func Uint[T constraints.Integer](v T) *uint {
return To(uint(v))
}
// Uint32 returns an uint32 pointer value for the provided integer value.
func Uint32[T constraints.Integer](v T) *uint32 {
return To(uint32(v))
}
// Uint64 returns an uint64 pointer value for the provided integer value.
func Uint64[T constraints.Integer](v T) *uint64 {
return To(uint64(v))
}
// String returns a string pointer value for the provided string value.
func String(s string) *string {
return To(s)
}
// Bool returns a bool pointer value for the provided bool value.
func Bool(b bool) *bool {
return To(b)
}