You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GoJay ships with a powerful stream encoder part of the Stream API.
531
533
532
534
It allows to write continuously to an io.Writer and do JIT encoding of data fed to a channel to allow async consuming. You can set multiple consumers on the channel to be as performant as possible. Consumers are non blocking and are scheduled individually in their own go routine.
@@ -553,7 +555,7 @@ type user struct {
553
555
func (u *user) MarshalObject(enc *gojay.Encoder) {
554
556
enc.AddIntKey("id", u.id)
555
557
enc.AddStringKey("name", u.name)
556
-
enc.AddStringKey("id", u.email)
558
+
enc.AddStringKey("email", u.email)
557
559
}
558
560
func (u *user) IsNil() bool {
559
561
return u == nil
@@ -589,16 +591,14 @@ func main() {
589
591
s:=StreamChan(make(chan *user))
590
592
// start the stream encoder
591
593
// will block its goroutine until enc.Cancel(error) is called
0 commit comments