factory

package
v1.0.0-rc.1 Latest Latest
Warning

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

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

Documentation

Overview

Package factory constructs a database backend by name or by type.

It is the only package that imports every backend. Keeping it separate from the root database package is what allows backends to depend on database for the Database[T] and Table[T] interfaces without forming an import cycle.

Importing this package registers all built-in backends. To construct a backend directly (and skip this indirection), import the backend package and call its NewDatabase function instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New[T any](name string, config map[string]string) (database.Database[T], error)

New resolves name through the driver registry and opens that backend.

The name must have been registered by a backend's init function; importing this package registers every built-in one. Use database.Drivers to list the available names.

func Open

func Open[T any](dbType database.DbType, config map[string]string) (database.Database[T], error)

Open opens a backend directly by DbType, bypassing name resolution.

Types

This section is empty.

Jump to

Keyboard shortcuts

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