MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / WithReceipt

Function WithReceipt

client/receipt.go:41–45  ·  view source on GitHub ↗

WithReceipt returns a context who holds a *atomic.Value. A *Receipt will be set to this value after the query succeeds. Note that this context is safe for concurrent queries, but the value may be reset in another goroutines. So if you want to make use of Receipt in several goroutines, you should ca

(ctx context.Context)

Source from the content-addressed store, hash-verified

39// goroutines. So if you want to make use of Receipt in several goroutines, you should call this
40// method to get separated child context in each goroutine.
41func WithReceipt(ctx context.Context) context.Context {
42 var value atomic.Value
43 value.Store((*Receipt)(nil))
44 return context.WithValue(ctx, &ctxReceiptKey, &value)
45}
46
47// GetReceipt tries to get *Receipt from context.
48func GetReceipt(ctx context.Context) (rec *Receipt, ok bool) {

Callers 1

TestConnFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestConnFunction · 0.68