pointerKit

package
v1.30.13 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertPointer

func AssertPointer(ptr interface{}, variableName string) error

AssertPointer 断言是指针

@param ptr 可以为nil,但会断言失败 @param variableName 传参ptr在上一层的变量名

func IsPointer

func IsPointer(obj interface{}) bool

IsPointer

e.g. (nil) => false

func IsPointer1

func IsPointer1(obj interface{}) bool

IsPointer1 *

  • 判断参数obj是否为指针(pointer).
  • 参考:github.com/json-iterator/go => reflect.go => func (iter *Iterator) ReadVal(obj interface{}) *
  • @param obj nil => false

func IsPointer2

func IsPointer2(obj interface{}) bool

IsPointer2

e.g. (nil) => false

func ToString

func ToString(ptr interface{}) string

ToString 指针 => 指针的地址字符串(十六进制表示,前缀 0x)

e.g. tmp := 1 (&tmp) => "0xc00000a228" e.g.1 (nil) => "%!p(<nil>)"

Types

This section is empty.

Jump to

Keyboard shortcuts

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