Add NewCommandTag
Useful for mocking and testing. https://github.com/jackc/pgx/issues/1273#issuecomment-1224154013
This commit is contained in:
@@ -667,6 +667,11 @@ type CommandTag struct {
|
|||||||
s string
|
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
|
// 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.
|
// for a row affecting command (e.g. "CREATE TABLE") then it returns 0.
|
||||||
func (ct CommandTag) RowsAffected() int64 {
|
func (ct CommandTag) RowsAffected() int64 {
|
||||||
|
|||||||
Reference in New Issue
Block a user