Skip to content

Commit

Permalink
chore: code format
Browse files Browse the repository at this point in the history
  • Loading branch information
kevwan committed Jan 22, 2025
1 parent 030c859 commit e6ca4a3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions core/stores/sqlx/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var (

type (
statGetter struct {
host string
dbName string
hash string
poolStats func() sql.DBStats
Expand Down
5 changes: 3 additions & 2 deletions core/stores/sqlx/sqlmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"

"github.com/go-sql-driver/mysql"

"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/core/syncx"
)

Expand All @@ -29,10 +29,11 @@ func getCachedSqlConn(driverName, server string) (*sql.DB, error) {

if driverName == mysqlDriverName {
if cfg, err := mysql.ParseDSN(server); err != nil {
// do nothing here
logx.Error(err)

Check warning on line 32 in core/stores/sqlx/sqlmanager.go

View check run for this annotation

Codecov / codecov/patch

core/stores/sqlx/sqlmanager.go#L32

Added line #L32 was not covered by tests
} else {
checksum := sha256.Sum256([]byte(server))
connCollector.registerClient(&statGetter{
host: cfg.Addr,

Check warning on line 36 in core/stores/sqlx/sqlmanager.go

View check run for this annotation

Codecov / codecov/patch

core/stores/sqlx/sqlmanager.go#L36

Added line #L36 was not covered by tests
dbName: cfg.DBName,
hash: hex.EncodeToString(checksum[:]),
poolStats: func() sql.DBStats {
Expand Down
2 changes: 1 addition & 1 deletion tools/goctl/api/gogen/handler_test.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ func Test{{.HandlerName}}(t *testing.T) {
assert.Contains(t, rr.Body.String(), tt.wantResp)
})
}
}
}
2 changes: 1 addition & 1 deletion tools/goctl/api/gogen/logic_test.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ func Test{{.logic}}_{{.function}}(t *testing.T) {
tt.checkResp({{if .hasResponse}}resp, {{end}}err)
})
}
}
}

0 comments on commit e6ca4a3

Please sign in to comment.