pgdesign v0.26.0 /internal/format
On this page

Package format implements canonical TOML formatting for pgdesign schema files, reordering sections via a comment-preserving go-toml-edit AST in place.

#internal/format

#internal/format

Package format implements canonical TOML formatting for pgdesign schema files, reordering sections via a comment-preserving go-toml-edit AST in place.

It parses the input via go-toml-edit to get a comment-preserving AST, then reorders sections in-place according to canonical ordering. Comments attached to sections and keys travel with them during reordering.

#Config

Go go
type Config struct

Config controls formatting behavior.

#DefaultConfig

Go go
func DefaultConfig() *Config

DefaultConfig returns a Config with default values.

#Format

Go go
func Format(input []byte, config *Config) ([]byte, error)

Format parses input TOML bytes and returns the canonically formatted output. Comments are preserved: leading comments and inline comments on sections and keys travel with their associated node during reordering.

Search