Skip to content

Commit

Permalink
Imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Aug 22, 2024
1 parent 40ce59d commit 9897b72
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
8 changes: 5 additions & 3 deletions sources/dynamodb/dynamodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package dynamodb
import (
"context"
"fmt"

"github.com/aws/aws-sdk-go-v2/aws/arn"
awsCfg "github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/credentials"

"github.com/artie-labs/reader/config"
"github.com/artie-labs/reader/sources"
"github.com/artie-labs/reader/sources/dynamodb/snapshot"
"github.com/artie-labs/reader/sources/dynamodb/stream"
"github.com/aws/aws-sdk-go-v2/aws/arn"
awsCfg "github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/credentials"
)

func Load(ctx context.Context, cfg config.DynamoDB) (sources.Source, bool, error) {
Expand Down
4 changes: 2 additions & 2 deletions sources/dynamodb/snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package snapshot
import (
"context"
"fmt"
"github.com/artie-labs/reader/lib/dynamo"
"github.com/aws/aws-sdk-go-v2/aws"
"log/slog"
"time"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/dynamodb"
"github.com/aws/aws-sdk-go-v2/service/dynamodbstreams/types"

"github.com/artie-labs/reader/config"
"github.com/artie-labs/reader/lib/dynamo"
"github.com/artie-labs/reader/lib/logger"
"github.com/artie-labs/reader/lib/s3lib"
"github.com/artie-labs/reader/writers"
Expand Down
10 changes: 5 additions & 5 deletions sources/dynamodb/snapshot/snapshot_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ import (
"github.com/aws/aws-sdk-go-v2/service/dynamodbstreams/types"
)

type SnapshotIterator struct {
type Iterator struct {
ch chan map[string]types.AttributeValue
keys []string
tableName string
batchSize int32
done bool
}

func NewSnapshotIterator(ch chan map[string]types.AttributeValue, keys []string, tblName string, batchSize int32) *SnapshotIterator {
return &SnapshotIterator{
func NewSnapshotIterator(ch chan map[string]types.AttributeValue, keys []string, tblName string, batchSize int32) *Iterator {
return &Iterator{
ch: ch,
keys: keys,
tableName: tblName,
batchSize: batchSize,
}
}

func (s *SnapshotIterator) HasNext() bool {
func (s *Iterator) HasNext() bool {
return !s.done
}

func (s *SnapshotIterator) Next() ([]lib.RawMessage, error) {
func (s *Iterator) Next() ([]lib.RawMessage, error) {
var msgs []lib.RawMessage
for msg := range s.ch {
dynamoMsg, err := dynamo.NewMessageFromExport(msg, s.keys, s.tableName)
Expand Down
7 changes: 4 additions & 3 deletions sources/dynamodb/stream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"log/slog"
"time"

"github.com/artie-labs/reader/config"
"github.com/artie-labs/reader/sources/dynamodb/offsets"
"github.com/artie-labs/reader/writers"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/dynamodbstreams"
"github.com/aws/aws-sdk-go-v2/service/dynamodbstreams/types"

"github.com/artie-labs/reader/config"
"github.com/artie-labs/reader/sources/dynamodb/offsets"
"github.com/artie-labs/reader/writers"
)

const (
Expand Down

0 comments on commit 9897b72

Please sign in to comment.