Documentation ¶
Overview ¶
DBDeployer - The MySQL Sandbox Copyright © 2006-2018 Giuseppe Maxia
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func CommandToJson(c Command) string
- func DryRunCmd(cmd string, dryRun bool) (string, error)
- func DryRunCmdWithArgs(cmd string, args []string, dryRun bool) (string, error)
- func Execute()
- func ExportAnnotationToJson(ea ExportAnnotation) string
- func ExportJson() string
- func ExportJsonNamed(name string, subCommand string) string
- func SandboxNames(n int) cobra.PositionalArgs
- type Command
- type ExportAnnotation
- type Option
- type RequiredInfo
- type TemplateInfo
Constants ¶
This section is empty.
Variables ¶
var DoubleStringExport = ExportAnnotation{ Arguments: []RequiredInfo{ {HowMany: 2, Name: globals.ExportString}, }, }
An annotation defining two generic string arguments
var ReplicationExport = ExportAnnotation{ Arguments: []RequiredInfo{ {HowMany: 1, Name: globals.ExportVersionDir}, }, Options: []RequiredInfo{ {HowMany: 1, Name: globals.ExportTopology, ReferenceData: globals.ExportAllowedTopologies}, }, }
An annotation defining what are the minimum required arguments for replication
var StringExport = ExportAnnotation{ Arguments: []RequiredInfo{ {HowMany: 1, Name: globals.ExportString}, }, }
An annotation defining an argument as a generic string
var TemplateGroupExport = ExportAnnotation{ Arguments: []RequiredInfo{ {HowMany: 1, Name: globals.ExportTemplateGroup}, {HowMany: 1, Name: globals.ExportTemplateName}, }, }
An annotation defining a string parameter of type sandbox template-group
var TemplateNameExport = ExportAnnotation{ Arguments: []RequiredInfo{ {HowMany: 1, Name: globals.ExportTemplateName}, }, }
An annotation defining a string parameter of type sandbox template-name
Functions ¶
func CommandToJson ¶ added in v1.28.0
Converts a Command structure to JSON
func DryRunCmdWithArgs ¶ added in v1.29.0
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func ExportAnnotationToJson ¶ added in v1.28.0
func ExportAnnotationToJson(ea ExportAnnotation) string
Converts an annotation structure to a JSON string
func ExportJson ¶ added in v1.28.0
func ExportJson() string
Exports the whole dbdeployer structure to JSON
func ExportJsonNamed ¶ added in v1.28.0
Export a given sub-command as JSON
func SandboxNames ¶ added in v1.28.0
func SandboxNames(n int) cobra.PositionalArgs
Types ¶
type Command ¶ added in v1.28.0
type Command struct { Version string `json:"version,omitempty"` // dbdeployer version Name string `json:"name"` // Name of the command itself Use string `json:"use"` // How to use it Aliases []string `json:"aliases,omitempty"` // Alternative names for this command Short string `json:"short,omitempty"` // Short usage description Long string `json:"long,omitempty"` // Long usage description Example string `json:"example,omitempty"` // Usage examples, if any Breadcrumbs []string `json:"ancestors"` // sequence of commands up to this (sub)command SubCommands []Command `json:"commands,omitempty"` // Children of this (sub)command Options []Option `json:"flags,omitempty"` // List of flags valid for this command NeedSubCommands bool `json:"needs_sub_commands"` // When the command alone cannot execute Annotations ExportAnnotation `json:"annotations,omitempty"` // Arguments and constraints for this command }
Describes a command (or sub-command)
type ExportAnnotation ¶ added in v1.28.0
type ExportAnnotation struct { Arguments []RequiredInfo `json:"arguments,omitempty"` // Required or recommended arguments Options []RequiredInfo `json:"options,omitempty"` // Options needed for this command }
Defines what is needed for a command at the end of the known keywords
type Option ¶ added in v1.28.0
type Option struct { Name string `json:"name"` // Name of the option Type string `json:"type"` // Type Usage string `json:"usage"` // Brief help on how to use this option Shortcut string `json:"shortcut"` // Option abbreviation Default string `json:"default"` // Default value }
Describes a command option
type RequiredInfo ¶ added in v1.28.0
type RequiredInfo struct { HowMany int `json:"n"` // How many times this item should be used Name string `json:"name"` // Name of the item ReferenceData string `json:"ref_data,omitempty"` // Data used for multiple choice (if available) }
Describes the parameters needed after a known parameter such as a command keyword or an option