Marshal Operator

February 25, 2020 ยท View on GitHub

Overview

Transform the items emitted by an Observable by applying a marshaller function (func(interface{}) ([]byte, error)) to each item.

Example

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

observable := rxgo.Just(
	customer{
		ID: 1,
	},
	customer{
		ID: 2,
	},
)().Marshal(json.Marshal)

Output:

{"id":1}
{"id":2}

Options

  • WithBufferedChannel

  • WithContext

  • WithObservationStrategy

  • WithErrorStrategy

  • WithPool

  • WithCPUPool

  • WithPublishStrategy

Contents

  1. 1Overview
  2. 2Example
  3. 3Options