mirror of
https://github.com/fleetdm/fleet
synced 2026-05-06 06:48:54 +00:00
#23525 # Demo <div> <a href="https://www.loom.com/share/e252ac2038b34941a9043867f79228f3"> <p>[Demo] Handling timeout and insufficient permission errors in NDES #23525 - Watch Video</p> </a> <a href="https://www.loom.com/share/e252ac2038b34941a9043867f79228f3"> <img style="max-width:300px;" src="https://cdn.loom.com/sessions/thumbnails/e252ac2038b34941a9043867f79228f3-2ff60eb9e0f54dd5-full-play.gif"> </a> </div> # Checklist for submitter If some of the following don't apply, delete the relevant line. <!-- Note that API documentation changes are now addressed by the product design team. --> - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files) for more information. - [x] Added/updated tests - [x] Manual QA for all new/changed functionality
73 lines
1.3 KiB
Go
73 lines
1.3 KiB
Go
// Package ptr includes functions for creating pointers from values.
|
|
package ptr
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
// String returns a pointer to the provided string.
|
|
func String(x string) *string {
|
|
return &x
|
|
}
|
|
|
|
// Int returns a pointer to the provided int.
|
|
func Int(x int) *int {
|
|
return &x
|
|
}
|
|
|
|
// Uint returns a pointer to the provided uint.
|
|
func Uint(x uint) *uint {
|
|
return &x
|
|
}
|
|
|
|
// Bool returns a pointer to the provided bool.
|
|
func Bool(x bool) *bool {
|
|
return &x
|
|
}
|
|
|
|
// BoolPtr returns a double pointer to the provided bool.
|
|
func BoolPtr(x bool) **bool {
|
|
p := Bool(x)
|
|
return &p
|
|
}
|
|
|
|
func StringPtr(x string) **string {
|
|
p := String(x)
|
|
return &p
|
|
}
|
|
|
|
// Time returns a pointer to the provided time.Time.
|
|
func Time(x time.Time) *time.Time {
|
|
return &x
|
|
}
|
|
|
|
// TimePtr returns a *time.Time Pointer (**time.Time) for the provided time.
|
|
func TimePtr(x time.Time) **time.Time {
|
|
t := Time(x)
|
|
return &t
|
|
}
|
|
|
|
// RawMessage returns a pointer to the provided json.RawMessage.
|
|
func RawMessage(x json.RawMessage) *json.RawMessage {
|
|
return &x
|
|
}
|
|
|
|
// Float64 returns a pointer to a float64.
|
|
func Float64(x float64) *float64 {
|
|
return &x
|
|
}
|
|
|
|
// Float64Ptr returns a pointer to a *float64.
|
|
func Float64Ptr(x float64) **float64 {
|
|
p := Float64(x)
|
|
return &p
|
|
}
|
|
|
|
func Int64(x int64) *int64 {
|
|
return &x
|
|
}
|
|
|
|
func Duration(x time.Duration) *time.Duration {
|
|
return &x
|
|
}
|