dataset

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DatasetCmd = &cobra.Command{
	Use:   "dataset",
	Short: "Set your current working dataset.",
	Long:  `Set your current working dataset.`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		config.InitDB()
	},
	Run: func(cmd *cobra.Command, args []string) {
		showFull, _ := cmd.Flags().GetBool("full")

		var userSettings models.UserSettings
		s, _ := userSettings.Get()

		client := api.PennsieveClient
		response, err := client.Dataset.Get(nil, s.UseDatasetId)
		if err != nil {
			log.Fatalln("Unknown dataset: ", s.UseDatasetId)
		}

		PrettyPrint(response, showFull)
	},
}

whoamiCmd represents the whoami command

View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "Set your current working dataset.",
	Long:  `Set your current working dataset.`,
	Run: func(cmd *cobra.Command, args []string) {

	},
}

whoamiCmd represents the whoami command

View Source
var UseCmd = &cobra.Command{
	Use:   "use <dataset>",
	Short: "Set your current working dataset.",
	Long: `Set your current working dataset.
	
	ARGS:
    <dataset>    
            A dataset's ID. If omitted, the current dataset will be printed.
	`,
	Args: cobra.MinimumNArgs(1),
	Run: func(cmd *cobra.Command, args []string) {

		datasetId := args[0]

		req := pb.UseDatasetRequest{
			DatasetId: datasetId,
		}

		port := viper.GetString("agent.port")

		conn, err := grpc.Dial(":"+port, grpc.WithTransportCredentials(insecure.NewCredentials()))
		if err != nil {
			fmt.Println("Error connecting to GRPC Server: ", err)
			return
		}
		defer conn.Close()

		client := pb.NewAgentClient(conn)
		useDatasetResponse, err := client.UseDataset(context.Background(), &req)
		if err != nil {
			st := status.Convert(err)
			fmt.Println(st.Message())
			return
		}

		fmt.Println(useDatasetResponse)

	},
}

whoamiCmd represents the whoami command

Functions

func PrettyPrint

func PrettyPrint(ds *pennsieve.GetDatasetResponse, showFull bool)

Types

This section is empty.

Jump to

Keyboard shortcuts

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