ptr

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapOf

func MapOf[K comparable, V any](value map[K]V) map[K]*V

MapOf 将值映射转换为指针映射

func MapValue

func MapValue[K comparable, V any](value map[K]*V) map[K]V

MapValue 将指针映射转换为值映射

func Of

func Of[T any](value T) *T

Of 将值转换为指向该值的指针

func SliceOf

func SliceOf[T any](value []T) []*T

SliceOf 将值切片转换为指针切片

func SliceValue

func SliceValue[T any](value []*T) []T

SliceValue 将指针切片转换为值切片

func Value

func Value[T any](value *T) T

Value 从指针中获取值,如果指针为nil则返回零值 注意:如果指针为nil,返回的零值可能不是你期望的零值, 例如:*int 为 0,*string 为 "",*bool 为 false 等。

Types

This section is empty.

Jump to

Keyboard shortcuts

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