feat(backend): add transactional outbox and embedded goose migrations
This commit is contained in:
1 parent
653f3775f8
commit
15e2e50561
40 files changed
+2471
-67
No files matched your search
@@ -3,3 +3,20 @@
|
||||
// sqlc v1.31.1
|
||||
|
||||
package sqlc
|
||||
|
||||
import (
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
type OutboxEvent struct {
|
||||
Position pgtype.Int8
|
||||
EventID pgtype.UUID
|
||||
EventType string
|
||||
SchemaVersion int32
|
||||
AggregateType string
|
||||
AggregateID pgtype.UUID
|
||||
AggregateVersion int64
|
||||
Payload []byte
|
||||
OccurredAt pgtype.Timestamptz
|
||||
PublishedAt pgtype.Timestamptz
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
// source: outbox.sql
|
||||
|
||||
package sqlc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
const insertOutboxEvent = `-- name: InsertOutboxEvent :exec
|
||||
INSERT INTO outbox_events (
|
||||
event_id,
|
||||
event_type,
|
||||
schema_version,
|
||||
aggregate_type,
|
||||
aggregate_id,
|
||||
aggregate_version,
|
||||
payload
|
||||
) VALUES (
|
||||
$1,
|
||||
$2,
|
||||
$3,
|
||||
$4,
|
||||
$5,
|
||||
$6,
|
||||
$7
|
||||
)
|
||||
`
|
||||
|
||||
type InsertOutboxEventParams struct {
|
||||
EventID pgtype.UUID
|
||||
EventType string
|
||||
SchemaVersion int32
|
||||
AggregateType string
|
||||
AggregateID pgtype.UUID
|
||||
AggregateVersion int64
|
||||
Payload []byte
|
||||
}
|
||||
|
||||
func (q *Queries) InsertOutboxEvent(ctx context.Context, arg InsertOutboxEventParams) error {
|
||||
_, err := q.db.Exec(ctx, insertOutboxEvent,
|
||||
arg.EventID,
|
||||
arg.EventType,
|
||||
arg.SchemaVersion,
|
||||
arg.AggregateType,
|
||||
arg.AggregateID,
|
||||
arg.AggregateVersion,
|
||||
arg.Payload,
|
||||
)
|
||||
return err
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
)
|
||||
|
||||
type Querier interface {
|
||||
InsertOutboxEvent(ctx context.Context, arg InsertOutboxEventParams) error
|
||||
Ping(ctx context.Context) (int32, error)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user