MCPcopy Create free account
hub / github.com/dolthub/doltgresql / getContextValues

Function getContextValues

core/context.go:55–67  ·  view source on GitHub ↗

getContextValues accesses the contextValues in the given context. If the context does not have a contextValues, then it creates one and adds it to the context.

(ctx *sql.Context)

Source from the content-addressed store, hash-verified

53// getContextValues accesses the contextValues in the given context. If the context does not have a contextValues, then
54// it creates one and adds it to the context.
55func getContextValues(ctx *sql.Context) (*contextValues, error) {
56 sess := dsess.DSessFromSess(ctx.Session)
57 if sess.DoltgresSessObj == nil {
58 cv := &contextValues{}
59 sess.DoltgresSessObj = cv
60 return cv, nil
61 }
62 cv, ok := sess.DoltgresSessObj.(*contextValues)
63 if !ok {
64 return nil, errors.Errorf("context contains an unknown values struct of type: %T", sess.DoltgresSessObj)
65 }
66 return cv, nil
67}
68
69// ClearContextValues clears all context values. This is primarily for operations that are directly called from Dolt, as
70// Dolt does not have the Doltgres concept of context values. Care must be taken to ensure that intermediate state

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected