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

Function GetCastsCollectionFromContext

core/context.go:446–468  ·  view source on GitHub ↗

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

(ctx *sql.Context, database string)

Source from the content-addressed store, hash-verified

444// GetCastsCollectionFromContext returns the given casts collection from the context.
445// Will always return a collection if no error is returned.
446func GetCastsCollectionFromContext(ctx *sql.Context, database string) (*casts.Collection, error) {
447 cv, err := getContextValues(ctx)
448 if err != nil {
449 return nil, err
450 }
451 if cv.casts == nil {
452 cv.casts = make(map[string]*casts.Collection)
453 }
454 if len(database) == 0 {
455 database = ctx.GetCurrentDatabase()
456 }
457 if cv.casts[database] == nil {
458 _, root, err := getRootFromContextForDatabase(ctx, database)
459 if err != nil {
460 return nil, err
461 }
462 cv.casts[database], err = casts.LoadCasts(ctx, root)
463 if err != nil {
464 return nil, err
465 }
466 }
467 return cv.casts[database], nil
468}
469
470// CloseContextRootFinalizer finalizes any changes persisted within the context by writing them to the working root.
471// This should ONLY be called by the ContextRootFinalizer node.

Callers 14

RowIterMethod · 0.92
drainRowIterFunction · 0.92
FindCommonTypeFunction · 0.92
QuerySingleReturnMethod · 0.92
ResolveDefaultValuesMethod · 0.92
EvalMethod · 0.92
EvalMethod · 0.92
EvalMethod · 0.92
EvalMethod · 0.92
RowIterMethod · 0.92

Calls 3

LoadCastsFunction · 0.92
getContextValuesFunction · 0.85

Tested by

no test coverage detected