database

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package database describes the database a XenForo environment is configured to use, and how to reach it from a client running on the host.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OrbStackHost

func OrbStackHost(service, instance string) string

OrbStackHost returns the hostname OrbStack gives a compose service, which resolves from macOS without publishing ports: <service>.<project>.orb.local.

Types

type Driver

type Driver string

Driver identifies a database engine supported by the environment.

const (
	DriverMySQL    Driver = "mysql"
	DriverPostgres Driver = "postgres"
	DriverMSSQL    Driver = "mssql"
	DriverSQLite   Driver = "sqlite"
)

func Detect

func Detect(contexts []string) (Driver, error)

Detect resolves the driver selected by a set of compose contexts, as found in XF_CONTEXTS.

The first database context wins. The database engine is not declared anywhere else the host can read, so the context is the source of truth until XenForo itself can be asked.

func (Driver) DefaultPort

func (d Driver) DefaultPort() int

DefaultPort returns the TCP port the driver listens on, or 0 for file-based drivers such as SQLite.

func (Driver) Scheme

func (d Driver) Scheme() string

Scheme returns the URL scheme clients expect for the driver.

type Info

type Info struct {
	Driver   Driver
	Host     string
	Port     int
	User     string
	Password string
	Name     string
	FilePath string
}

Info describes a resolved database connection.

func (Info) URL

func (i Info) URL() string

URL renders the connection URL used to open the database in a GUI or CLI client. SQLite is file-based, so its "URL" is the file path.

Jump to

Keyboard shortcuts

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