From 180ab61207b679549d2c7a1efa2c4e19ce154c33 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Mon, 17 Feb 2020 13:36:27 +0000 Subject: [PATCH] Ensure live queries occur before event queries --- db/create.go | 4 ++-- db/delete.go | 4 ++-- db/insert.go | 4 ++-- db/relate.go | 4 ++-- db/update.go | 4 ++-- db/upsert.go | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/db/create.go b/db/create.go index 2548cd72..640f19c7 100644 --- a/db/create.go +++ b/db/create.go @@ -157,11 +157,11 @@ func (d *document) runCreate(ctx context.Context, stm *sql.CreateStatement) (int return nil, err } - if err = d.event(ctx, met); err != nil { + if err = d.lives(ctx, met); err != nil { return nil, err } - if err = d.lives(ctx, met); err != nil { + if err = d.event(ctx, met); err != nil { return nil, err } diff --git a/db/delete.go b/db/delete.go index cbf9d406..b4a9f53e 100644 --- a/db/delete.go +++ b/db/delete.go @@ -162,11 +162,11 @@ func (d *document) runDelete(ctx context.Context, stm *sql.DeleteStatement) (int return nil, err } - if err = d.event(ctx, met); err != nil { + if err = d.lives(ctx, met); err != nil { return nil, err } - if err = d.lives(ctx, met); err != nil { + if err = d.event(ctx, met); err != nil { return nil, err } diff --git a/db/insert.go b/db/insert.go index f4702be4..8437cdb2 100644 --- a/db/insert.go +++ b/db/insert.go @@ -125,11 +125,11 @@ func (d *document) runInsert(ctx context.Context, stm *sql.InsertStatement) (int return nil, err } - if err = d.event(ctx, met); err != nil { + if err = d.lives(ctx, met); err != nil { return nil, err } - if err = d.lives(ctx, met); err != nil { + if err = d.event(ctx, met); err != nil { return nil, err } diff --git a/db/relate.go b/db/relate.go index 32a0dd92..dffc10e2 100644 --- a/db/relate.go +++ b/db/relate.go @@ -155,11 +155,11 @@ func (d *document) runRelate(ctx context.Context, stm *sql.RelateStatement) (int return nil, err } - if err = d.event(ctx, met); err != nil { + if err = d.lives(ctx, met); err != nil { return nil, err } - if err = d.lives(ctx, met); err != nil { + if err = d.event(ctx, met); err != nil { return nil, err } diff --git a/db/update.go b/db/update.go index 8735303e..6e45a01b 100644 --- a/db/update.go +++ b/db/update.go @@ -168,11 +168,11 @@ func (d *document) runUpdate(ctx context.Context, stm *sql.UpdateStatement) (int return nil, err } - if err = d.event(ctx, met); err != nil { + if err = d.lives(ctx, met); err != nil { return nil, err } - if err = d.lives(ctx, met); err != nil { + if err = d.event(ctx, met); err != nil { return nil, err } diff --git a/db/upsert.go b/db/upsert.go index 550a23fe..4306fba9 100644 --- a/db/upsert.go +++ b/db/upsert.go @@ -131,11 +131,11 @@ func (d *document) runUpsert(ctx context.Context, stm *sql.UpsertStatement) (int return nil, err } - if err = d.event(ctx, met); err != nil { + if err = d.lives(ctx, met); err != nil { return nil, err } - if err = d.lives(ctx, met); err != nil { + if err = d.event(ctx, met); err != nil { return nil, err }