From 7837fb6fa001ef78bc76e66b48445dee7b2db37b Mon Sep 17 00:00:00 2001 From: Qt Date: Sun, 20 Feb 2022 21:19:15 +0800 Subject: [PATCH] fix typo in TxCommitter interface comment & improve CheckTruth, chek val empty first (#5094) * fix typo in TxCommitter interface comment * improve CheckTruth, chek val empty first --- interfaces.go | 2 +- utils/utils.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces.go b/interfaces.go index ff0ca60a..44a85cb5 100644 --- a/interfaces.go +++ b/interfaces.go @@ -50,7 +50,7 @@ type ConnPoolBeginner interface { BeginTx(ctx context.Context, opts *sql.TxOptions) (ConnPool, error) } -// TxCommitter tx commiter +// TxCommitter tx committer type TxCommitter interface { Commit() error Rollback() error diff --git a/utils/utils.go b/utils/utils.go index 28ca0daf..296917b9 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -39,7 +39,7 @@ func IsValidDBNameChar(c rune) bool { // CheckTruth check string true or not func CheckTruth(vals ...string) bool { for _, val := range vals { - if !strings.EqualFold(val, "false") && val != "" { + if val != "" && !strings.EqualFold(val, "false") { return true } }