github.com/chain5j/chain5j-pkg@v1.0.7/util/convutil/convert.go (about) 1 // Package convutil 2 // 3 // @author: xwc1125 4 package convutil 5 6 func BytesToBool(input []byte) (bool, error) { 7 if input == nil || len(input) == 0 { 8 return false, nil 9 } 10 return input[0] == 1, nil 11 } 12 13 func BytesToString(input []byte) (string, error) { 14 if input == nil || len(input) == 0 { 15 return "", nil 16 } 17 return string(input), nil 18 }