mus-stream-go is a streaming version of mus-go.
It maintains the same structure but replaces byte slices with the Writer
and
Reader
interfaces for streaming data.
You can learn more about this in the mus-go documentation. Here is just a small example:
package main
import "github.com/mus-format/mus-go/varint"
func main() {
var (
num = 100
size = varint.Int.Size(num)
bs = make([]byte, size)
buf = bytes.NewBuffer(bs) // Create a Writer/Reader.
)
n, err := varint.Int.Marshal(num, buf)
// ...
num, n, err = varint.Int.Unmarshal(buf)
// ...
}
Another thing to note is that with a real connection (instead of bytes.Buffer
),
you need to use the bufio
package. This is because bufio.Writer
and
bufio.Reader
implement the muss.Writer
and muss.Reader
interfaces.
mus-stream-dts-go provides DTM support.