From 6a327a26fed7a827639d09fbaeaa9f5f2a247938 Mon Sep 17 00:00:00 2001 From: Travis Turner Date: Wed, 15 Aug 2018 10:31:27 -0500 Subject: [PATCH] add deprecation warnings for --string-keys flag --- cmd/import.go | 1 + ctl/import.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/cmd/import.go b/cmd/import.go index d88cd5402..c09e9c77d 100644 --- a/cmd/import.go +++ b/cmd/import.go @@ -51,6 +51,7 @@ omitted. If it is present then its format should be YYYY-MM-DDTHH:MM. flags.StringVarP(&Importer.Host, "host", "", "localhost:10101", "host:port of Pilosa.") flags.StringVarP(&Importer.Index, "index", "i", "", "Pilosa index to import into.") flags.StringVarP(&Importer.Field, "field", "f", "", "Field to import into.") + flags.BoolVar(&Importer.StringKeys, "string-keys", false, "DEPRECATED (key type is now determined by index/field configuration): Treat payload as string keys.") flags.IntVarP(&Importer.BufferSize, "buffer-size", "s", 10000000, "Number of bits to buffer/sort before importing.") flags.BoolVarP(&Importer.Sort, "sort", "", false, "Enables sorting before import.") flags.BoolVarP(&Importer.CreateSchema, "create", "e", false, "Create the schema if it does not exist before import.") diff --git a/ctl/import.go b/ctl/import.go index 5d2b2546f..06cc662d1 100644 --- a/ctl/import.go +++ b/ctl/import.go @@ -46,6 +46,9 @@ type ImportCommand struct { // nolint: maligned // CreateSchema ensures the schema exists before import CreateSchema bool + // DEPRECATED: Indicates that the payload should be treated as string keys. + StringKeys bool `json:"StringKeys"` + // Filenames to import from. Paths []string `json:"paths"` @@ -76,6 +79,11 @@ func NewImportCommand(stdin io.Reader, stdout, stderr io.Writer) *ImportCommand func (cmd *ImportCommand) Run(ctx context.Context) error { logger := log.New(cmd.Stderr, "", log.LstdFlags) + // DEPRECATED: warning that --string-keys flag has been deprecated. + if cmd.StringKeys { + logger.Printf("DEPRECATED: The string-keys flag is no longer used.") + } + // Validate arguments. // Index and field are validated early before the files are parsed. if cmd.Index == "" {