lookup

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package lookup holds the connection seam used by transformers that read their values from the database when they are built. It exists as its own package because pkg/transformers/builder's table driven tests construct every registered transformer and have no database, and they cannot reach an unexported variable in pkg/transformers.

Index

Constants

This section is empty.

Variables

View Source
var NewQuerier = func(ctx context.Context, url string) (pglib.Querier, error) {
	return pglib.NewConnPool(ctx, url)
}

NewQuerier opens the connection a lookup load runs on. It is a variable so that tests can build lookup based transformers without a database; replace it with StubQuerier.

Functions

func StubQuerier

func StubQuerier(oid uint32, values []any, opts StubOptions) func(context.Context, string) (pglib.Querier, error)

StubQuerier returns a NewQuerier replacement serving the given values as a single column of the given pg type OID. It lives beside the seam so that every package testing a lookup based transformer shares one test double.

Types

type StubOptions

type StubOptions struct {
	NewQuerierErr error
	QueryErr      error
	ScanErr       error
	RowsErr       error
	// Closed reports whether the querier and its rows were closed
	Closed *bool
	// Query captures the SQL the loader built
	Query *string
}

StubOptions configures the failure a StubQuerier injects. The zero value serves the values successfully.

Jump to

Keyboard shortcuts

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