View Source OnePiece.Commanded.EventStore.JsonbSerializer (OnePiece.Commanded v0.19.1)

A JSONB serializer based on events defined by OnePiece.Commanded.Event.

It uses OnePiece.Commanded.Event to cast the event to the correct type, by proxying, using Ecto.Schemas and Ecto.Changesets.

Configuring

To use this serializer, add it to your config.exs:

config :my_app, MyApp.EventStore,
  serializer: OnePiece.Commanded.EventStore.JsonbSerializer,
  types: EventStore.PostgresTypes

Summary

Functions

Deserialize given JSON binary data to the expected type.

Serialize given term to JSON binary data.

Functions

Link to this function

deserialize(term, config \\ [])

View Source

Deserialize given JSON binary data to the expected type.

It is already a map since EventStore.PostgresTypes will take care of the deserialization. Then, it will use OnePiece.Commanded.Event to cast the event to the correct type.

Serialize given term to JSON binary data.

It is just a passthrough, since EventStore.PostgresTypes will take care of the serialization.