extensionslot

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package extensionslot owns external-store loading for ORM slot handles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binding

type Binding[M, S any] struct {
	Name, Table string
	Get         func(M) S
	Set         func(M, S) M
	Loaded      func(S) bool
	Count       func(S) int
	Fetch       Fetch[M, S]
	Unbound     error
}

Binding captures the typed slot accessors and runtime fetch. Example: New(binding).

type Fetch

type Fetch[M, S any] func(context.Context, database.Executor, []M) ([]S, error)

Fetch returns values aligned with the supplied parents. Example: Fetch[Parent,Value](fetch).

type Slot

type Slot[M any] struct {
	// contains filtered or unexported fields
}

Slot retains only shared state; callbacks retain the concrete parent/value codecs. Example: slot := New(binding).

func New

func New[M, S any](binding Binding[M, S]) Slot[M]

New snapshots a binding without invoking its callbacks. Example: New(binding).

func (Slot[M]) Load

func (s Slot[M]) Load(ctx context.Context, ex database.Executor, parents []M, limits querycore.RelationLimits, remaining, attached *int, missing bool) ([]M, error)

Load fills an owned parent slice under the shared relation budgets. Example: slot.Load(ctx,ex,parents,limits,&remaining,&attached,true).

func (Slot[M]) Metadata

func (s Slot[M]) Metadata() (string, string, reflect.Type, error)

Metadata exposes validated slot shape without dispatch. Example: slot.Metadata().

Jump to

Keyboard shortcuts

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