inspect

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package inspect runs an inspection command of an application and returns the JSON document that it printed.

The routes, the modules and the models of an application live in its own code, so the CLI and the MCP server both ask the application. The application answers before it loads the configuration and before it opens the database. See the SDD, S14 and S16.

Index

Constants

View Source
const (
	// Routes returns the routes of the application.
	Routes = "routes"
	// Modules returns the contribution of each module.
	Modules = "modules"
	// OpenAPI returns the description of the API of the application.
	OpenAPI = "openapi"
	// Schema returns the models that the modules describe.
	Schema = "schema"
	// Doctor proves the configuration, the database and the broker.
	Doctor = "doctor"
	// Migrate applies the migrations of every module of the application, or
	// reports the ones that the database does not hold. The migrations stand
	// in the binary, so the application applies them.
	Migrate = "migrate"
)

The inspection commands.

View Source
const Prefix = "avero:"

Prefix marks a command that the binary sends to the application.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	// Stdout holds the document that the application printed.
	Stdout string
	// Stderr holds the faults that the application printed.
	Stderr string
	// Code is the exit code of the application.
	Code int
}

Result is the answer of one inspection.

func Run

func Run(ctx context.Context, dir, command string, asJSON bool, args ...string) (*Result, error)

Run asks the application for one inspection. asJSON returns the document that the schema of the report accepts. args carry the step of a command that states one, such as `avero:migrate up`.

The application reads the environment of this process. RunWithEnv states another environment, which the migration command needs: it reads .env, so a person migrates with no export.

func RunWithEnv added in v0.5.1

func RunWithEnv(ctx context.Context, dir, command string, environment []string, args ...string) (*Result, error)

RunWithEnv asks the application for one inspection with the environment that the caller states.

Jump to

Keyboard shortcuts

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