MCPcopy Create free account
hub / github.com/cloudwan/gohan / withinDatabase

Function withinDatabase

db/db.go:147–162  ·  view source on GitHub ↗
(
	db DB,
	fn func(transaction.Transaction) error,
	beginStrategy func() (ITransaction, error),
)

Source from the content-addressed store, hash-verified

145}
146
147func withinDatabase(
148 db DB,
149 fn func(transaction.Transaction) error,
150 beginStrategy func() (ITransaction, error),
151) error {
152 return WithinTemplate(
153 db.Options().RetryTxCount,
154 func() time.Duration {
155 return db.Options().RetryTxInterval
156 },
157 beginStrategy,
158 func(tx ITransaction) error {
159 return fn(tx.(transaction.Transaction))
160 },
161 )
162}
163
164// Within executes a scoped transaction on a database
165func Within(db DB, fn func(transaction.Transaction) error) error {

Callers 2

WithinFunction · 0.85
WithinTxFunction · 0.85

Calls 2

WithinTemplateFunction · 0.85
OptionsMethod · 0.65

Tested by

no test coverage detected