From 80835fa2ae2b19b942d805b4f7333aba8575c552 Mon Sep 17 00:00:00 2001 From: Chelo Doz Date: Mon, 20 May 2024 15:09:50 -0300 Subject: [PATCH] fix: NewText return --- .../repository/repository.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/examples/golang-api-with-postgres-and-sqlc/repository/repository.go b/examples/golang-api-with-postgres-and-sqlc/repository/repository.go index 32c64c9..18ff91e 100644 --- a/examples/golang-api-with-postgres-and-sqlc/repository/repository.go +++ b/examples/golang-api-with-postgres-and-sqlc/repository/repository.go @@ -76,11 +76,5 @@ func (r *UserRepository) ListUsers(ctx context.Context) ([]model.User, error) { } func NewText(s string) pgtype.Text { - if s == "" { - return pgtype.Text{} - } - return pgtype.Text{ - String: s, - Valid: true, - } + return pgtype.Text{String: s, Valid: s != ""} }