Skip to content
Go client for the Serialized.io REST API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd/cereal
example Fix argument naming May 1, 2019
test Fix linter issues May 1, 2019
testdata
.gitignore
.travis.yml
LICENSE
README.md
client.go Update documentation May 2, 2019
doc.go
es.go
es_test.go
event.go
feed.go
feed_test.go
go.mod
go.sum
helper_test.go
projection.go
projection_test.go
reaction.go
reaction_test.go

README.md

Serialized.io Go client

Build Status GoDoc Go Report Card License MIT

Provides access to the Serialized.io REST API.

Installation

go get github.com/marcusolsson/serialized-go

Usage

package main

import (
    "context"
    "fmt"
    "log"
    "os"

    serialized "github.com/marcusolsson/serialized-go"
)

func main() {
    var (
        accessKey       = os.Getenv("SERIALIZED_ACCESS_KEY")
        secretAccessKey = os.Getenv("SERIALIZED_SECRET_ACCESS_KEY")
    )

    client := serialized.NewClient(
        serialized.WithAccessKey(accessKey),
        serialized.WithSecretAccessKey(secretAccessKey),
    )

    err := client.Feed(context.Background(), "order", 0, func(entry *serialized.FeedEntry) {
        for _, event := range entry.Events {
            if event.Type == "OrderPaidEvent" {
                fmt.Printf("The order with ID %s was paid\n", entry.AggregateID)
            }
        }
    })
    if err != nil {
        log.Fatal(err)
    }
}
You can’t perform that action at this time.