MCPcopy
hub / github.com/cayleygraph/cayley / NewInitDatabaseCmd

Function NewInitDatabaseCmd

cmd/cayley/command/database.go:66–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64}
65
66func NewInitDatabaseCmd() *cobra.Command {
67 cmd := &cobra.Command{
68 Use: "init",
69 Short: "Create an empty database.",
70 RunE: func(cmd *cobra.Command, args []string) error {
71 printBackendInfo()
72 name := viper.GetString(KeyBackend)
73 if graph.IsRegistered(name) && !graph.IsPersistent(name) {
74 return ErrNotPersistent
75 }
76 // TODO: maybe check read-only flag in config before that?
77 if err := initDatabase(); err != nil {
78 return err
79 }
80 return nil
81 },
82 }
83 return cmd
84}
85
86func NewLoadDatabaseCmd() *cobra.Command {
87 cmd := &cobra.Command{

Callers 1

initFunction · 0.92

Calls 4

IsRegisteredFunction · 0.92
IsPersistentFunction · 0.92
printBackendInfoFunction · 0.85
initDatabaseFunction · 0.85

Tested by

no test coverage detected