2
0

Add NewCommandTag

Useful for mocking and testing.

https://github.com/jackc/pgx/issues/1273#issuecomment-1224154013
This commit is contained in:
Jack Christensen
2022-08-23 19:39:15 -05:00
parent fe3a4f3150
commit bb6c997102
+5
View File
@@ -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 {