gitlab.com/evatix-go/core@v1.3.55/cmd/main/nullTesting01.go (about)

     1  package main
     2  
     3  import (
     4  	"errors"
     5  	"fmt"
     6  
     7  	"gitlab.com/evatix-go/core/isany"
     8  )
     9  
    10  func nullTesting01() {
    11  	var ex error
    12  	var inx *int
    13  	items := []interface{}{
    14  		nil,
    15  		errors.New(""),
    16  		ex,
    17  		inx,
    18  	}
    19  
    20  	for i, item := range items {
    21  		fmt.Println(i, "- {(defined, isnull, ==nil, %T} == ",
    22  			isany.Defined(item),
    23  			isany.Null(item),
    24  			item == nil,
    25  			fmt.Sprintf("%T", item))
    26  	}
    27  
    28  	fmt.Println("----------------------")
    29  
    30  	for i, item := range items {
    31  		NullPrinter(i, item)
    32  	}
    33  }