Documentation ¶
Index ¶
- Constants
- func Cmd() *cobra.Command
- func Migrations(ctx context.Context, in *proto.MigrationsRequest, ba backendAction) (*proto.MigrationsResponse, error)
- func Run(ctx context.Context, gc gRPCClient, command string, ...) error
- type MigrationResponse
- func (mR MigrationResponse) Faulty() bool
- func (mR MigrationResponse) GetOutput() (string, error)
- func (mR MigrationResponse) GetStats() (string, error)
- func (mR MigrationResponse) OutputSince(lines int) (string, int)
- func (mR MigrationResponse) Running() bool
- func (mR MigrationResponse) Yaml() (string, error)
Constants ¶
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 Migrations ¶
func Migrations(ctx context.Context, in *proto.MigrationsRequest, ba backendAction) (*proto.MigrationsResponse, error)
Migrations runs a migrations command.
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.