File: helper.go

package info (click to toggle)
golang-github-hetznercloud-hcloud-go 2.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,072 kB
  • sloc: sh: 5; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 657 bytes parent folder | download
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
package hcloud

import "time"

// Ptr returns a pointer to p.
func Ptr[T any](p T) *T {
	return &p
}

// String returns a pointer to the passed string s.
//
// Deprecated: Use [Ptr] instead.
func String(s string) *string { return Ptr(s) }

// Int returns a pointer to the passed integer i.
//
// Deprecated: Use [Ptr] instead.
func Int(i int) *int { return Ptr(i) }

// Bool returns a pointer to the passed bool b.
//
// Deprecated: Use [Ptr] instead.
func Bool(b bool) *bool { return Ptr(b) }

// Duration returns a pointer to the passed time.Duration d.
//
// Deprecated: Use [Ptr] instead.
func Duration(d time.Duration) *time.Duration { return Ptr(d) }