github.com/gogf/gf@v1.16.9/database/gdb/gdb_core_link.go (about)

     1  // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the MIT License.
     4  // If a copy of the MIT was not distributed with this file,
     5  // You can obtain one at https://github.com/gogf/gf.
     6  
     7  package gdb
     8  
     9  import (
    10  	"database/sql"
    11  )
    12  
    13  // dbLink is used to implement interface Link for DB.
    14  type dbLink struct {
    15  	*sql.DB
    16  }
    17  
    18  // txLink is used to implement interface Link for TX.
    19  type txLink struct {
    20  	*sql.Tx
    21  }
    22  
    23  // IsTransaction returns if current Link is a transaction.
    24  func (*dbLink) IsTransaction() bool {
    25  	return false
    26  }
    27  
    28  // IsTransaction returns if current Link is a transaction.
    29  func (*txLink) IsTransaction() bool {
    30  	return true
    31  }