From bb6c9971023beed746bce04a8f979fc99688a09c Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Tue, 23 Aug 2022 19:39:15 -0500 Subject: [PATCH] Add NewCommandTag Useful for mocking and testing. https://github.com/jackc/pgx/issues/1273#issuecomment-1224154013 --- pgconn/pgconn.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pgconn/pgconn.go b/pgconn/pgconn.go index e29283f4..44de2897 100644 --- a/pgconn/pgconn.go +++ b/pgconn/pgconn.go @@ -667,6 +667,11 @@ type CommandTag struct { s string } +// NewCommandTag makes a CommandTag from s. +func NewCommandTag(s string) CommandTag { + return CommandTag{s: s} +} + // RowsAffected returns the number of rows affected. If the CommandTag was not // for a row affecting command (e.g. "CREATE TABLE") then it returns 0. func (ct CommandTag) RowsAffected() int64 {