cli

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FinishedParsing

func FinishedParsing(cmd *cobra.Command)

FinishedParsing transitions a cobra.Command from treating RunE errors as usage errors to treating them just as normal runtime errors that should be propagated up to the root command's Execute method without also printing the subcommand's usage text on stderr. A subcommand should call this function from its RunE function when it has finished processing its flags and is moving into the pure "business logic" of its entrypoint.

Package vitess.io/vitess/go/cmd/vtctldclient/internal/command has more details on why this exists.

func MarshalJSON

func MarshalJSON(obj interface{}) ([]byte, error)

MarshalJSON marshals obj to a JSON string. It uses the jsonpb marshaler for proto.Message types, with some sensible defaults, and falls back to the standard Go marshaler otherwise. In both cases, the marshaled JSON is indented with two spaces for readability.

Unfortunately jsonpb only works for types that implement proto.Message, either by being a proto message type or by anonymously embedding one, so for other types that may have nested struct fields, we still use the standard Go marshaler, which will result in different formattings.

func MarshalMapAWK

func MarshalMapAWK(m map[string]string) string

MarshalMapAWK returns a string representation of a string->string map in an AWK-friendly format.

func MarshalTabletAWK

func MarshalTabletAWK(t *topodatapb.Tablet) string

MarshalTabletAWK marshals a tablet into an AWK-friendly line.

func ParseKeyspaceShards

func ParseKeyspaceShards(args []string) ([]*vtctldatapb.Shard, error)

ParseKeyspaceShards takes a list of positional arguments and converts them to vtctldatapb.Shard objects.

func TabletAliasesFromPosArgs

func TabletAliasesFromPosArgs(args []string) ([]*topodatapb.TabletAlias, error)

TabletAliasesFromPosArgs takes a list of positional (non-flag) arguments and converts them to tablet aliases.

Types

type KeyspaceIDTypeFlag

type KeyspaceIDTypeFlag topodatapb.KeyspaceIdType

KeyspaceIDTypeFlag adds the pflag.Value interface to a topodatapb.KeyspaceIdType.

func (*KeyspaceIDTypeFlag) Set

func (v *KeyspaceIDTypeFlag) Set(arg string) error

Set is part of the pflag.Value interface.

func (*KeyspaceIDTypeFlag) String

func (v *KeyspaceIDTypeFlag) String() string

String is part of the pflag.Value interface.

func (*KeyspaceIDTypeFlag) Type

func (v *KeyspaceIDTypeFlag) Type() string

Type is part of the pflag.Value interface.

type KeyspaceTypeFlag

type KeyspaceTypeFlag topodatapb.KeyspaceType

KeyspaceTypeFlag adds the pflag.Value interface to a topodatapb.KeyspaceType.

func (*KeyspaceTypeFlag) Set

func (v *KeyspaceTypeFlag) Set(arg string) error

Set is part of the pflag.Value interface.

func (*KeyspaceTypeFlag) String

func (v *KeyspaceTypeFlag) String() string

String is part of the pflag.Value interface.

func (*KeyspaceTypeFlag) Type

func (v *KeyspaceTypeFlag) Type() string

Type is part of the pflag.Value interface.

type ReplicatingTablet

type ReplicatingTablet struct {
	*replicationdatapb.Status
	*topodatapb.Tablet
}

ReplicatingTablet is a struct to group a Tablet together with its replication Status.

func SortedReplicatingTablets

func SortedReplicatingTablets(tabletMap map[string]*topodatapb.Tablet, replicationStatuses map[string]*replicationdatapb.Status) []*ReplicatingTablet

SortedReplicatingTablets returns a sorted list of replicating tablets (which is a struct grouping a Tablet together with its replication Status).

The sorting order is: 1. Tablets that do not have a replication Status. 2. Any tablets of type PRIMARY. 3. Remaining tablets sorted by comparing replication positions.

type StringMapValue

type StringMapValue struct {
	flagutil.StringMapValue
}

StringMapValue augments flagutil.StringMapValue so it can be used as a pflag.Value.

func (*StringMapValue) Type

func (v *StringMapValue) Type() string

Type is part of the pflag.Value interface.

Jump to

Keyboard shortcuts

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