Skip to content

mus-format/mus-stream-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mus-stream-go

Go Reference GoReportCard codecov

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.

How To

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.

DTM (Data Type Metadata) Support

mus-stream-dts-go provides DTM support.