database

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package database opens supported GORM SQL drivers and exposes driver metadata.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capabilities

type Capabilities struct {
	Transactions          bool
	Savepoints            bool
	ForeignKeyConstraints bool
	Returning             bool
	Upsert                bool
	AdvisoryLocks         bool
	ConcurrentIndexBuilds bool
}

Capabilities names behavior that differs across supported database drivers.

func CapabilitiesFor

func CapabilitiesFor(driver Driver) Capabilities

CapabilitiesFor returns the capability model for driver.

type DB

type DB struct {
	*gorm.DB
	// contains filtered or unexported fields
}

DB is an opened GORM database with Gombit driver metadata.

func Open

func Open(cfg config.DatabaseConfig) (*DB, error)

Open opens a GORM database for a supported config.DatabaseConfig.

func (*DB) Capabilities

func (db *DB) Capabilities() Capabilities

Capabilities returns the configured driver's capability flags.

func (*DB) Close

func (db *DB) Close() error

Close closes the underlying database/sql handle.

func (*DB) Driver

func (db *DB) Driver() Driver

Driver returns the configured driver.

func (*DB) SQLDB

func (db *DB) SQLDB() (*sql.DB, error)

SQLDB returns the underlying database/sql handle.

type Driver

type Driver string

Driver names a supported database driver.

const (
	// DriverSQLite identifies SQLite.
	DriverSQLite Driver = Driver(config.DatabaseDriverSQLite)
	// DriverPostgres identifies PostgreSQL.
	DriverPostgres Driver = Driver(config.DatabaseDriverPostgres)
	// DriverMySQL identifies MySQL.
	DriverMySQL Driver = Driver(config.DatabaseDriverMySQL)
)

Directories

Path Synopsis
Package conformance hosts the multi-DB conformance suite.
Package conformance hosts the multi-DB conformance suite.
models
Package models holds GORM fixtures for the multi-DB conformance suite.
Package models holds GORM fixtures for the multi-DB conformance suite.

Jump to

Keyboard shortcuts

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