queryscope

package
v1.3.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package queryscope provides the primitive that wrappers use to push a per-call SQL constraint onto the request context for inner stores to consume. The configstore and logstore packages both import it so the same QueryScope mechanism powers their ScopedDB read paths without introducing a cycle between the two stores.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithQueryScope

func WithQueryScope(ctx context.Context, scope QueryScope) context.Context

WithQueryScope returns ctx carrying scope. Nil scope is a no-op.

Types

type QueryScope

type QueryScope func(*gorm.DB) *gorm.DB

QueryScope mutates a query to enforce caller-driven row-level constraints. Set on ctx by an upstream wrapper; inner store query helpers apply it blindly via ScopedDB.

func FromContext

func FromContext(ctx context.Context) QueryScope

FromContext returns the scope stashed on ctx, or nil when no scope is present (background jobs, OSS-only deployments, internal lookups that bypassed the wrapper). A nil scope is equivalent to "no restriction": query builders apply no WHERE clause.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL