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

Function GetFunctionsCollectionFromContext

core/context.go:315–337  ·  view source on GitHub ↗

GetFunctionsCollectionFromContext returns the functions collection from the given context. Will always return a collection if no error is returned.

(ctx *sql.Context, database string)

Source from the content-addressed store, hash-verified

313// GetFunctionsCollectionFromContext returns the functions collection from the given context. Will always return a
314// collection if no error is returned.
315func GetFunctionsCollectionFromContext(ctx *sql.Context, database string) (*functions.Collection, error) {
316 cv, err := getContextValues(ctx)
317 if err != nil {
318 return nil, err
319 }
320 if cv.funcs == nil {
321 cv.funcs = make(map[string]*functions.Collection)
322 }
323 if len(database) == 0 {
324 database = ctx.GetCurrentDatabase()
325 }
326 if cv.funcs[database] == nil {
327 _, root, err := getRootFromContextForDatabase(ctx, database)
328 if err != nil {
329 return nil, err
330 }
331 cv.funcs[database], err = functions.LoadFunctions(ctx, root)
332 if err != nil {
333 return nil, err
334 }
335 }
336 return cv.funcs[database], nil
337}
338
339// GetProceduresCollectionFromContext returns the procedures collection from the given context. Will always return a
340// collection if no error is returned.

Callers 6

FunctionMethod · 0.92
RowIterMethod · 0.92
RowIterMethod · 0.92
loadFunctionFunction · 0.92
RowIterMethod · 0.92

Calls 3

LoadFunctionsFunction · 0.92
getContextValuesFunction · 0.85

Tested by

no test coverage detected