project

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: PostgreSQL Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERROR       = "error"
	NEW         = "new"
	INITIALIZED = "initialized"
	INSPECTED   = "inspected"
	AUDITED     = "audited"
	CONVERTED   = "converted"
)

Variables

This section is empty.

Functions

func Abs added in v0.0.13

func Abs(p string) string

Abs returns the absolute path of a JSON file.

Resolve path for current project. Add missing json extension if needed. Resolve to internal json file for known file names.

func Offline added in v0.18.0

func Offline()

Offline disable source access

func Open added in v0.18.0

func Open() error

func Outdated added in v1.0.0

func Outdated(path string, reqs ...string) bool

Outdated returns true if: - path does not exist or is not readable. - path is outdated compared to configuration file or any of the reqs.

func Rel added in v0.0.13

func Rel(p string) string

func WriteJson added in v0.29.0

func WriteJson(name string, data any) error

WriteJson saves data as project JSON file.

Use [Json] to read file.

Types

type Config added in v0.0.2

type Config struct {
	Schemas []string `comment:"Restrict to schemas matching one of these patterns."`
	Scores  map[string]float32
	Convert Convert
	Dump    Dump
}

func (*Config) CheckRules added in v1.2.0

func (c *Config) CheckRules() error

func (*Config) Merge added in v1.2.0

func (c *Config) Merge(o Config)

Merge another config in config

To prevent merging default initialized values, copy current config before reading another file. Then use [Merge] to effectively merge lists and maps.

Merges complexity scores maps. Merges DataTypes maps. Merges Convert.Rules array and each rule map. Merges Dump.Objects arrays. Overrides other values.

func (Config) NewFrom added in v1.2.0

func (c Config) NewFrom() Config

NewFrom create a new config using current values as default

Use [decode] to apply a TOML to result. Use [Merge] to merge properly slices and maps.

type Convert added in v0.22.0

type Convert struct {
	PreserveCase      bool
	RenameConstraints bool
	RenameIndexes     bool
	TrueValues        []string
	Rules             []Rule

	DataTypes map[string]string
	// contains filtered or unexported fields
}

func (Convert) Rule added in v0.22.0

func (c Convert) Rule(path string) Rule

func (Convert) UnusedRules added in v1.0.0

func (c Convert) UnusedRules() error

type Dump added in v0.27.0

type Dump struct {
	Objects    []string
	Force      bool
	StripZeros bool
}

Dump holds dump configuration.

func (*Dump) MergeObjects added in v1.2.0

func (d *Dump) MergeObjects(input []string)

MergeObjects aggregate patterns

The purpose is to implement TOML and CLI args merging. d.Objects holds TOML patterns and input is the CLI args.

The final merged pattern list contains: - first the positive input patterns - then the negation from TOML - last, the negation from input

type Info

type Info struct {
	Creator string
	Created time.Time
	Driver  string
	Source  ServerInfo
	Target  ServerInfo
}

type Project

type Project struct {
	Path   string
	Status string
	Config Config
	Info   Info       `json:"-"`
	Source *dburl.URL `json:"-"`
	Target *dburl.URL `json:"-"`
}
var Current Project

func (Project) Dir

func (p Project) Dir() string

func (*Project) GuessStatus added in v0.0.10

func (p *Project) GuessStatus() string

func (Project) Json added in v0.0.2

func (p Project) Json(name string, out any) error

Json reads named project JSON file

Use WriteJson to save to JSON file.

func (Project) Name added in v0.0.14

func (p Project) Name() string

func (Project) Online added in v0.0.14

func (p Project) Online() bool

func (*Project) Override added in v1.1.0

func (p *Project) Override(path string) string

Override returns override file path if exists empty string otherwise

func (*Project) Read

func (p *Project) Read() error

func (Project) Toml added in v0.0.2

func (p Project) Toml() string

type Rule added in v0.0.2

type Rule struct {
	Path       string
	Name       string
	Type       string
	TrueValues []string
	Expression string
	// contains filtered or unexported fields
}

func (Rule) IsZero added in v1.2.0

func (r Rule) IsZero() bool

type ServerInfo added in v0.24.0

type ServerInfo struct {
	InitialDSN string
	Software   string
	Version    string
}

Jump to

Keyboard shortcuts

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