Skip to content

Latest commit

 

History

History
54 lines (34 loc) · 904 Bytes

unmarshal.md

File metadata and controls

54 lines (34 loc) · 904 Bytes

Unmarshal Operator

Overview

Transform the items emitted by an Observable by applying an unmarshaller function (func([]byte, interface{}) error) to each item. It takes a factory function that initializes the target structure.

Example

type customer struct {
	ID int `json:"id"`
}

observable := rxgo.Just([][]byte{
	[]byte(`{"id":1}`),
	[]byte(`{"id":2}`),
}).Unmarshal(json.Unmarshal,
	func() interface{} {
		return &customer{}
	})

Output:

&{ID:1}
&{ID:2}

Options

WithBufferedChannel

Detail

WithContext

Detail

WithObservationStrategy

Detail

WithErrorStrategy

Detail

WithPool

https://github.com/ReactiveX/RxGo/wiki/Options#withpool

WithCPUPool

https://github.com/ReactiveX/RxGo/wiki/Options#withcpupool