github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/db/internal/internal.go (about)

     1  // Package internal exposes internal functions used within db packages.
     2  package internal
     3  
     4  // NonNilBytes ensures that bz is a non-nil byte slice (ie. []byte{}).
     5  //
     6  // We defensively turn nil keys or values into []byte{} for
     7  // most operations.
     8  func NonNilBytes(bz []byte) []byte {
     9  	if bz == nil {
    10  		return []byte{}
    11  	}
    12  	return bz
    13  }