migrations

package
v0.0.0-...-294dc8c Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MigrationsHelp contains the short help text for the command.
	MigrationsHelp = "Wrapper to the OpenSlides backend migration tool for applying migrations to the datastore."

	// MigrationsHelpExtra contains the long help text for the command without
	// the headline.
	MigrationsHelpExtra = `See help text for the repective commands for more information.`
)

Variables

This section is empty.

Functions

func Cmd

func Cmd() *cobra.Command

Cmd returns the subcommand.

func Migrations

func Migrations(ctx context.Context, in *proto.MigrationsRequest, ba backendAction) (*proto.MigrationsResponse, error)

Migrations runs a migrations command.

func Run

func Run(ctx context.Context, gc gRPCClient, command string, intervalFlag *time.Duration, timeoutFlag *time.Duration) error

Run calls respective procedure to run migrations command via given gRPC client.

Types

type MigrationResponse

type MigrationResponse struct {
	Success   bool            `json:"success"`
	Status    string          `json:"status"`
	Output    string          `json:"output"`
	Exception string          `json:"exception"`
	Stats     json.RawMessage `json:"stats"`
}

MigrationResponse handles the JSON response from the backend when calling migrations commands.

func (MigrationResponse) Faulty

func (mR MigrationResponse) Faulty() bool

Faulty returns True if the migration command returns success false or any exception string.

func (MigrationResponse) GetOutput

func (mR MigrationResponse) GetOutput() (string, error)

GetOutput parses and returns the output field of the migrations commands reponse for proper display. If the reponse conveys an error happened, all fields are returned.

func (MigrationResponse) GetStats

func (mR MigrationResponse) GetStats() (string, error)

GetStats parses and returns the stats field of the migrations commands reponse for proper display. If the reponse conveys an error happened, all fields are returned.

func (MigrationResponse) OutputSince

func (mR MigrationResponse) OutputSince(lines int) (string, int)

OutputSince provides the content of the migrations response output. The number of given lines where omitted and we also get the number of lines of the rest of the content.

func (MigrationResponse) Running

func (mR MigrationResponse) Running() bool

Running returns True if the migration command returns status "migration_running".

func (MigrationResponse) Yaml

func (mR MigrationResponse) Yaml() (string, error)

Yaml returns the migrations command reponse formatted in YAML for proper display.

Jump to

Keyboard shortcuts

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