registry

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package registry is the catalogue of modules platformgo knows how to wire in.

For every module it holds exactly what the generator needs: package, settings type, dependencies and environment variables. That is why enabling a module needs no code changes: the generator assembles the wiring from this description.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Names

func Names() []string

Names returns the names of known modules.

Types

type EnvVar

type EnvVar struct {
	Key      string
	Example  string
	Comment  string
	Required bool
}

EnvVar describes an environment variable of a module for .env.example.

type Module

type Module struct {
	Name     string   // section name in platformgo.yaml
	Requires []string // modules it cannot work without
	Import   string   // import path of the module package
	Package  string   // package name in code
	Field    string   // field name in the project's Config struct
	Env      []EnvVar

	// ProjectPkg is a package generated inside the project that the module needs at
	// startup, given relative to the project module path. Empty for modules that need
	// nothing from the project.
	ProjectPkg   string
	ProjectAlias string   // name of that import in generated code
	ExtraArgs    []string // arguments passed to New after the settings

	// Compose is the local development service of the module in docker-compose.yml,
	// indented as an entry under services. Volumes lists the named volumes it uses.
	Compose string
	Volumes []string

	Tools []Tool

	Options []Option // what the module section of platformgo.yaml may contain
}

Module describes a platform module.

func All

func All() []Module

All returns every known module in alphabetical order.

func Get

func Get(name string) (Module, bool)

Get returns a module by name.

func (Module) ConfigType

func (m Module) ConfigType() string

ConfigType is the settings type of the module, for example postgres.Config.

func (Module) LoadCall

func (m Module) LoadCall() string

LoadCall is the call that reads settings from the environment.

func (Module) NewCall

func (m Module) NewCall() string

NewCall builds the module from the project's Config struct.

func (Module) Option added in v0.2.2

func (m Module) Option(name string) (Option, bool)

Option returns an option of the module by name.

type Option added in v0.2.2

type Option struct {
	Name        string
	Description string
	Default     string
}

Option is a technical setting of a module in platformgo.yaml.

type Tool added in v0.2.0

type Tool struct {
	Module  string // module path, "github.com/sqlc-dev/sqlc"
	Package string // what go tool runs, "github.com/sqlc-dev/sqlc/cmd/sqlc"
	Version string
}

Tool is a code generator a module needs in the project. It is pinned in the go.mod of the project, so every developer and CI run generate with the same version.

Jump to

Keyboard shortcuts

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