Help us shape the future of Go! Take the 2026 Go Developer Survey

db

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidDSN = errors.New("invalid or missing database configuration")

ErrInvalidDSN error is returned, when the DSN configuration is incorrect, or empty.

Functions

func GetResourcesFromDB added in v0.1.19

func GetResourcesFromDB[T any](ctx context.Context) ([]T, error)

GetResourcesFromDB fetches the given model from the database.

func LinkObjects

func LinkObjects(ctx context.Context, db *bun.DB, items []LinkFunction) error

LinkObjects links objects by using the provided LinkFunction items.

func NewFromConfig

func NewFromConfig(conf config.DatabaseConfig) (*bun.DB, error)

NewFromConfig creates a new bun.DB based on the provided config.DatabaseConfig spec.

Types

type LinkFunction

type LinkFunction func(ctx context.Context, db *bun.DB) error

LinkFunction is a function, which establishes relationships between models.

Jump to

Keyboard shortcuts

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