github.com/songzhibin97/go-baseutils@v0.0.2-0.20240302024150-487d8ce9c082/base/bpoint/README.md (about) 1 # bpoint 2 3 ## API 4 5 - ToPoint 传入v返回*v 6 - FromPoint 传入*v返回v 7 - FromPointOrDefaultIfNil 传入*v如果*v为nil返回default value 8 9 ## EXAMPLE 10 11 ```go 12 package main 13 14 import ( 15 "fmt" 16 "github.com/songzhibin97/go-baseutils/base/bpoint" 17 ) 18 19 func main() { 20 fmt.Println(*bpoint.ToPoint(1)) // 1 21 22 v := 1 23 fmt.Println(bpoint.FromPoint(&v)) // 1 24 25 var nv *int 26 fmt.Println(bpoint.FromPointOrDefaultIfNil(nv, 2)) // 2 27 } 28 29 ```