I am planning on implementing a queue and persisting the objects into a Bolt DB instance. I was wondering how to determine the sortedness of the items when reloading my application and determining head/tail.
To quote the Bolt DB project on insertion of items to a bucket:
Bolt stores its keys in byte-sorted order within a bucket
So basically the keys for the DB are byte [arrays] and sorted. I see an implementation online that uses the following line to convert an int to a byte array in little endian.
key := make([]byte, 8)
binary.BigEndian.PutUint64(key, id)
What other ways are there to convert the keys to byte arrays for sortedness?
Thanks