Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 422 Bytes

README.md

File metadata and controls

29 lines (20 loc) · 422 Bytes

bpoint

API

  • ToPoint 传入v返回*v
  • FromPoint 传入*v返回v
  • FromPointOrDefaultIfNil 传入v如果v为nil返回default value

EXAMPLE

package main

import (
	"fmt"
	"github.com/songzhibin97/go-baseutils/base/bpoint"
)

func main() {
	fmt.Println(*bpoint.ToPoint(1)) // 1

	v := 1
	fmt.Println(bpoint.FromPoint(&v)) // 1

	var nv *int
	fmt.Println(bpoint.FromPointOrDefaultIfNil(nv, 2)) // 2
}