Help us shape the future of Go! Take the 2026 Go Developer Survey

ptr

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: MIT Imports: 1 Imported by: 8

README

ptr

Package 'ptr' provides utility functions to get the pointer of the built-in type.

Codeship

Why?

text := returnsString()
takesStringPtr(&text)

text = returnsString()
str := struct {
  text *string
} {
  text: &text,
}

↓

takesStringPtr(ptr.String(returnsString()))

str := struct {
  text *string
} {
  text: ptr.String(returnsString()),
}

It's so trivial, but that is I want.

License

MIT License

This is distributed under the MIT License.

Documentation

Overview

Package ptr provides utility functions to get the pointer of the built-in type

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) *bool

Bool will get a pointer of the bool

func Byte

func Byte(b byte) *byte

Byte will get a pointer of the byte

func Complex64

func Complex64(c complex64) *complex64

Complex64 will get a pointer of the complex64

func Complex128

func Complex128(c complex128) *complex128

Complex128 will get a pointer of the complex128

func False

func False() *bool

False will get a pointer of the false

func Float32

func Float32(f float32) *float32

Float32 will get a pointer of the float32

func Float64

func Float64(f float64) *float64

Float64 will get a pointer of the float64

func Int

func Int(i int) *int

Int will get a pointer of the int

func Int8

func Int8(i int8) *int8

Int8 will get a pointer of the int8

func Int16

func Int16(i int16) *int16

Int16 will get a pointer of the int16

func Int32

func Int32(i int32) *int32

Int32 will get a pointer of the int32

func Int64

func Int64(i int64) *int64

Int64 will get a pointer of the int64

func Rune

func Rune(r rune) *rune

Rune will get a pointer of the rune

func String

func String(s string) *string

String will get a pointer of the string

func Time

func Time(t time.Time) *time.Time

Time will get a pointer of the time.Time

func True

func True() *bool

True will get a pointer of the true

func Uint

func Uint(u uint) *uint

Uint will get a pointer of the uint

func Uint8

func Uint8(u uint8) *uint8

Uint8 will get a pointer of the uint8

func Uint16

func Uint16(u uint16) *uint16

Uint16 will get a pointer of the uint16

func Uint32

func Uint32(u uint32) *uint32

Uint32 will get a pointer of the uint32

func Uint64

func Uint64(u uint64) *uint64

Uint64 will get a pointer of the uint64

Types

This section is empty.

Directories

Path Synopsis
Package pequal provides utility functions to compare two pointers of the built-in type
Package pequal provides utility functions to compare two pointers of the built-in type

Jump to

Keyboard shortcuts

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