MCPcopy Create free account
hub / github.com/cinar/indicator / CloseDatabaseWithError

Function CloseDatabaseWithError

helper/database.go:14–28  ·  view source on GitHub ↗

CloseDatabaseWithError closes the database after an error.

(db *sql.DB, err error)

Source from the content-addressed store, hash-verified

12
13// CloseDatabaseWithError closes the database after an error.
14func CloseDatabaseWithError(db *sql.DB, err error) error {
15 closeErr := db.Close()
16 if closeErr == nil {
17 return err
18 }
19
20 closeErr = fmt.Errorf("unable to close database: %w", closeErr)
21
22 if err != nil {
23 log.Println(closeErr)
24 return err
25 }
26
27 return closeErr
28}
29
30// CloseDatabaseRows closes the database rows.
31func CloseDatabaseRows(rows *sql.Rows) {

Callers 3

NewSQLRepositoryFunction · 0.92
CloseMethod · 0.92

Calls 1

CloseMethod · 0.45

Tested by 1