backends

package
v1.3.9 Latest Latest
Warning

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

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

Documentation

Overview

Package backends assembles a lookup.Provider: it builds the procedure and direct stores for one database and routes every operation to one of them according to lookup.Config. It lives apart from package lookup because both backends import lookup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Failed

func Failed(err error) *lookup.Provider

Failed returns a Provider whose every operation returns err. Constructors that cannot return an error use it so a bad configuration fails closed on first use.

func New

func New(db *sql.DB, cfg lookup.Config, opts Options) (*lookup.Provider, error)

New builds a Provider for db. cfg is merged with the defaults and validated; the dialect is cfg.Dialect or detected from the driver. Every operation's mode is resolved up front so an impossible combination (procedure mode on a non-Postgres dialect) fails here, not on the first request.

Types

type Options

type Options struct {
	// DBFactory is called to obtain a fresh *sql.DB when the current one has been closed.
	// Nil disables reconnecting.
	DBFactory func() (*sql.DB, error)
	// UpgradePasswordHash rewrites a legacy cleartext password as bcrypt after a successful
	// direct-mode login. Off by default.
	UpgradePasswordHash bool
	// NoGroupTables skips the group membership table when loading direct-mode policy rules.
	NoGroupTables bool
}

Options are the settings that are not naming or mode.

Jump to

Keyboard shortcuts

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