factory

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEntityManagerWithConfig

func NewEntityManagerWithConfig(config *forma.Config, pool *pgxpool.Pool) (forma.EntityManager, error)

NewEntityManagerWithConfig creates a new EntityManager with the provided configuration and database pool. This is the primary way for external projects to create an EntityManager instance.

config.SchemaRegistry must already be initialized before calling this function. The factory validates database state and builds the entity manager around the provided registry; it does not create a fallback registry.

Usage:

import (

"github.com/lychee-technology/forma"
"github.com/lychee-technology/forma/factory"

)

config := forma.DefaultConfig(registry) em, err := factory.NewEntityManagerWithConfig(config, pool)

if err != nil {
   // handle error
}

With custom SchemaRegistry:

config := forma.DefaultConfig(registry) config.SchemaRegistry = myCustomRegistry em, err := factory.NewEntityManagerWithConfig(config, pool)

func NewEntityManagerWithConfigContext added in v0.0.25

func NewEntityManagerWithConfigContext(ctx context.Context, config *forma.Config, pool *pgxpool.Pool) (forma.EntityManager, error)

NewEntityManagerWithConfigContext creates a new EntityManager using the provided context, configuration, and database pool. It is the canonical implementation; use this when you need to control the context used during initialisation (e.g. to propagate cancellation or deadlines to the startup queries).

See NewEntityManagerWithConfig for usage examples.

func NewFileSchemaRegistry added in v0.0.15

func NewFileSchemaRegistry(pool *pgxpool.Pool, schemaTable string, schemaDir string) (forma.SchemaRegistry, error)

func NewFileSchemaRegistryContext added in v0.0.29

func NewFileSchemaRegistryContext(ctx context.Context, pool *pgxpool.Pool, schemaTable string, schemaDir string) (forma.SchemaRegistry, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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