A Go module for a Queue (FIFO) of any structure. The Queue uses a []byte
as it's buffer, so it's easy to send the queue across a wire, or store it anywhere handy (file, RDBMS, Redis, basically anywhere you can store bytes).
If you add a struct that's a proto.Message, then it's marshaled as a proto.Message, otherwise it's marshaled as JSON.
Standard go get
:
go get github.com/jimlambrt/any
see:
// make a queue of anything
queue := any.Queue{Catalog: types}
// add anything
queue.Add(&user, &car, &rental)
// remove anything
queuedUser, err := queue.Remove()
Sometimes it's nice to be able to serialize anything into a queue that's buffered by a []byte