cmd

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Copyright © 2024 Roberto Antolin <rantolin DOT geo AT gmail DOT com>

Copyright © 2024 Roberto Antolin <rantolin DOT geo AT gmail DOT com>

Copyright © 2024 Roberto Antolin <rantolin DOT geo AT gmail DOT com>

Copyright © 2024 Roberto Antolin <rantolin DOT geo AT gmail DOT com>

Copyright © 2024 Roberto Antolin <rantolin DOT geo AT gmail DOT com>

Index

Constants

View Source
const (
	DefaultProfileName = "default"
)

Variables

View Source
var SetCmd = &cobra.Command{
	Use:   "set",
	Short: "Set the project and dataset",
	Long: `The 'set' command sets the project and dataset to be used by the bqsql tool.
These values are stored in a configuration file and are used by other commands to determine the project and dataset to operate on.
Use 'bqsql set --project_id my-project --dataset my_dataset'
`,
	Run: func(cmd *cobra.Command, args []string) {

		projectID, _ := cmd.Flags().GetString("project_id")
		datasetID, _ := cmd.Flags().GetString("dataset")
		profile, _ := cmd.Flags().GetString("profile")

		isDefault, _ := cmd.Flags().GetBool("default")
		WriteConfigFile(cmd.OutOrStdout(), isDefault, profile, projectID, datasetID)
	},
}

setCmd represents the set command

Functions

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 QueryBasic

func QueryBasic(cmd *cobra.Command, query string) error

QueryBasic demonstrates issuing a query and reading results.

func WriteConfigFile added in v0.0.2

func WriteConfigFile(w io.Writer, isDefault bool, profile string, projectID string, datasetID string)

Types

type Config added in v0.0.2

type Config struct {
	Configurations map[string]Configuration `mapstructure:"configurations"`
	Default        string                   `mapstructure:"default"`
}

type Configuration added in v0.0.2

type Configuration struct {
	Project string `mapstructure:"project"`
	Dataset string `mapstructure:"dataset"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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