add pkg/pointer package

some of the methods will now start taking pointer-based values, so lets
bring a utility to help passing those.

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
This commit is contained in:
Ciro S. Costa 2021-06-12 16:13:23 -04:00
parent 412e77f10a
commit 56034d55bd

41
pkg/pointer/pointer.go Normal file
View file

@ -0,0 +1,41 @@
package pointer
// Int32 returns a pointer to an int32.
func Int32(i int32) *int32 {
return &i
}
// Int64 returns a pointer to an int64.
func Int64(i int64) *int64 {
return &i
}
// Uint32 returns a pouinter to an uint32.
func Uint32(i uint32) *uint32 {
return &i
}
// Uint64 returns a pouinter to an uint64.
func Uint64(i uint64) *uint64 {
return &i
}
// Bool returns a pointer to a bool.
func Bool(b bool) *bool {
return &b
}
// String returns a pointer to a string.
func String(s string) *string {
return &s
}
// Float32 returns a pointer to the a float32.
func Float32(i float32) *float32 {
return &i
}
// Float64 returns a pointer to the a float64.
func Float64(i float64) *float64 {
return &i
}