github.com/blend/go-sdk@v1.20220411.3/examples/db/statement-timeout/finalize.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package main
     9  
    10  import (
    11  	"database/sql"
    12  	"log"
    13  
    14  	"github.com/blend/go-sdk/db"
    15  )
    16  
    17  func ignoreConnDone(err error) error {
    18  	if err == sql.ErrConnDone {
    19  		return nil
    20  	}
    21  	return err
    22  }
    23  
    24  func cleanUp(pool *db.Connection) {
    25  	err := ignoreConnDone(pool.Close())
    26  	if err != nil {
    27  		log.Fatal(err)
    28  	}
    29  }