ref

package
v1.20240719.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 1 Imported by: 2

Documentation

Overview

Package ref includes helpers for dealing with "optional" values represented by pointers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool returns a reference.

func Byte

func Byte(v byte) *byte

Byte returns a reference.

func Deref added in v1.20240719.1

func Deref[T comparable](p *T) T

Deref returns a dereferenced value. For certain types, this could still return nil.

func Derefs added in v1.20240719.1

func Derefs[T comparable](pointers ...*T) []T

Derefs returns a slice of dereferenced values. For certain types, this could still return nil.

func Duration

func Duration(v time.Duration) *time.Duration

Duration returns a reference.

func Float32

func Float32(v float32) *float32

Float32 returns a reference.

func Float64

func Float64(v float64) *float64

Float64 returns a reference.

func Int

func Int(v int) *int

Int returns a reference.

func Int16

func Int16(v int16) *int16

Int16 returns a reference.

func Int32

func Int32(v int32) *int32

Int32 returns a reference.

func Int64

func Int64(v int64) *int64

Int64 returns a reference.

func Int8

func Int8(v int8) *int8

Int8 returns a reference.

func Ref added in v1.20240719.1

func Ref[T any](v T) *T

Ref returns a reference.

func Refs added in v1.20240719.1

func Refs[T any](values ...T) []*T

Refs returns a slice of references.

func Rune

func Rune(v rune) *rune

Rune returns a reference.

func String

func String(v string) *string

String returns a reference.

func Strings

func Strings(values ...string) []*string

Strings returns a reference.

func Time

func Time(v time.Time) *time.Time

Time returns a reference.

func Uint16

func Uint16(v uint16) *uint16

Uint16 returns a reference.

func Uint32

func Uint32(v uint32) *uint32

Uint32 returns a reference.

func Uint64

func Uint64(v uint64) *uint64

Uint64 returns a reference.

func Uint8

func Uint8(v uint8) *uint8

Uint8 returns a reference.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL