forked from sourcenetwork/defradb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackup_import.go
32 lines (28 loc) · 917 Bytes
/
backup_import.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2023 Democratized Data Foundation
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
package cli
import (
"github.com/spf13/cobra"
)
func MakeBackupImportCommand() *cobra.Command {
var cmd = &cobra.Command{
Use: "import <input_path>",
Short: "Import a JSON data file to the database",
Long: `Import a JSON data file to the database.
Example: import data to the database:
defradb client import user_data.json`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
store := mustGetContextStore(cmd)
return store.BasicImport(cmd.Context(), args[0])
},
}
return cmd
}