config

package
v0.0.0-...-cb5b6c1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config loads the funq.yaml project file that anchors schema, generated output, migration, and development-database locations for every CLI command. It exists so commands take zero path flags in the common case: the file is discovered by walking up from the working directory, the same way go.mod is discovered.

Index

Constants

View Source
const FileName = "funq.yaml"

FileName is the project file discovered by Find and Load.

Variables

This section is empty.

Functions

func Find

func Find(dir string) (string, error)

Find walks up from dir looking for funq.yaml and returns its absolute path. It returns an error naming `funq init` when no project file is found between dir and the filesystem root.

Types

type Config

type Config struct {
	// Path is the absolute path to the loaded funq.yaml.
	Path string
	// Root is the directory containing funq.yaml. Relative paths in the
	// file are resolved against it, not against the working directory.
	Root string
	// SchemaDir is the absolute directory containing schema declarations.
	SchemaDir string
	// OutDir is the absolute directory generated Go output is written to.
	OutDir string
	// MigrationsDir is the absolute directory Goose migrations are written
	// to and read from.
	MigrationsDir string
	// contains filtered or unexported fields
}

Config is a funq.yaml project file resolved to absolute paths.

func Init

func Init(dir string) (*Config, error)

Init scaffolds a new funq.yaml in dir. It fails if a project file already exists at or above dir.

func Load

func Load(dir string) (*Config, error)

Load discovers and parses funq.yaml starting from dir.

func (*Config) DevURL

func (c *Config) DevURL() (string, error)

DevURL resolves the configured development database URL. A value of the form "env:NAME" is read from the named environment variable; any other non-empty value is used literally as a URL.

func (*Config) IRPath

func (c *Config) IRPath() string

IRPath is the resolved IR cache path written by `funq generate` and read by every migrate command.

Jump to

Keyboard shortcuts

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