Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
ref(): moved Wal2JsonChanges struct to types.go
Browse files Browse the repository at this point in the history
  • Loading branch information
le-vlad committed Apr 26, 2024
1 parent 7783f2f commit f8d2cb5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 65 deletions.
3 changes: 1 addition & 2 deletions example/simple/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"github.com/charmbracelet/log"
"github.com/usedatabrew/pglogicalstream"
"github.com/usedatabrew/pglogicalstream/messages"
"gopkg.in/yaml.v3"
"io/ioutil"
)
Expand All @@ -26,7 +25,7 @@ func main() {
panic(err)
}

pgStream.OnMessage(func(message messages.Wal2JsonChanges) {
pgStream.OnMessage(func(message pglogicalstream.Wal2JsonChanges) {
fmt.Println(message.Changes)
})
}
14 changes: 0 additions & 14 deletions messages/go.mod

This file was deleted.

32 changes: 0 additions & 32 deletions messages/go.sum

This file was deleted.

15 changes: 0 additions & 15 deletions messages/wal2json.go

This file was deleted.

16 changes: 14 additions & 2 deletions types.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
package pglogicalstream

import (
"github.com/usedatabrew/pglogicalstream/messages"
"github.com/apache/arrow/go/v14/arrow"
)

type OnMessage = func(message messages.Wal2JsonChanges)
type Wal2JsonChanges struct {
Lsn string
Changes []Wal2JsonChange `json:"change"`
}

type Wal2JsonChange struct {
Kind string `json:"action"`
Schema string `json:"schema"`
Table string `json:"table"`
Row arrow.Record `json:"data"`
}

type OnMessage = func(message Wal2JsonChanges)

0 comments on commit f8d2cb5

Please sign in to comment.