faraday/db/interfaces.go
2026-03-30 11:50:52 +02:00

22 lines
538 B
Go

package db
// QueriesTxOptions defines the set of db txn options the SQLQueries
// understands.
type QueriesTxOptions struct {
// readOnly governs if a read only transaction is needed or not.
readOnly bool
}
// ReadOnly returns true if the transaction should be read only.
//
// NOTE: This implements the TxOptions.
func (a *QueriesTxOptions) ReadOnly() bool {
return a.readOnly
}
// NewQueryReadTx creates a new read transaction option set.
func NewQueryReadTx() QueriesTxOptions {
return QueriesTxOptions{
readOnly: true,
}
}