I need to convert a slice of int64 to a byte array in golang. I am successfully able to do so for a single int64
var p int64 = -3984171602573983744
fmt.Println(p)
cn := make([]byte, 8)
binary.LittleEndian.PutUint64(cn, uint64(p))
fmt.Println(cn)
How can I implement it for a slice of int64?
To be more precise, I am trying to call a function in a library which writes to a DB, and that function takes a byte array as a param. I have a slice of int64 which I need to convert to a byte array and vice versa. Is this possible?