Categorygithub.com/0skillallluck/dynostream
repositorypackage
0.0.3
Repository: https://github.com/0skillallluck/dynostream.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

dynostream

Easy to use Stream Subscriber for DynamoDB

Usage

package main

import (
	"context"
	"log"

	"github.com/0skillallluck/dynostream"
	"github.com/aws/aws-sdk-go/aws/session"
)

func main() {
	// Create a new AWS session
	sess := session.New()

	// Create a new DynoStream
	stream := dynostream.NewFromSession(sess, "my-table")

	// Create a new context for the subscription
	ctx := context.Background()

	// Subscribe to the stream
	channel, errorChannel := stream.Subscribe(ctx)

	// Handle errors
	go func(errCh <-chan error) {
		for err := range errCh {
			log.Println("Error: ", err)
		}
	}(errorChannel)

	// Handle records
	for record := range channel {
		log.Println("Record:", record)
	}
}