github.com/songzhibin97/go-baseutils@v0.0.2-0.20240302024150-487d8ce9c082/base/bpoint/example_test.go (about)

     1  package bpoint
     2  
     3  import "fmt"
     4  
     5  func ExampleToPoint() {
     6  	fmt.Println(*ToPoint(1)) // 1
     7  }
     8  
     9  func ExampleFromPoint() {
    10  	v := 1
    11  	fmt.Println(FromPoint(&v)) // 1
    12  }
    13  
    14  func ExampleFromPointOrDefaultIfNil() {
    15  	var v *int
    16  	fmt.Println(FromPointOrDefaultIfNil(v, 2)) // 2
    17  }