MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / runDrop

Function runDrop

cmd/cql/internal/drop.go:52–94  ·  view source on GitHub ↗
(cmd *Command, args []string)

Source from the content-addressed store, hash-verified

50}
51
52func runDrop(cmd *Command, args []string) {
53 commonFlagsInit(cmd)
54
55 if len(args) != 1 {
56 ConsoleLog.Error("drop command need CovenantSQL dsn or database_id string as param")
57 SetExitStatus(1)
58 printCommandHelp(cmd)
59 Exit()
60 }
61
62 configInit()
63
64 dsn := args[0]
65
66 // drop database
67 if _, err := client.ParseDSN(dsn); err != nil {
68 // not a dsn/dbid
69 ConsoleLog.WithField("db", dsn).WithError(err).Error("not a valid dsn")
70 SetExitStatus(1)
71 return
72 }
73
74 txHash, err := client.Drop(dsn)
75 if err != nil {
76 // drop database failed
77 ConsoleLog.WithField("db", dsn).WithError(err).Error("drop database failed")
78 SetExitStatus(1)
79 return
80 }
81
82 if waitTxConfirmation {
83 err = wait(txHash)
84 if err != nil {
85 ConsoleLog.WithField("db", dsn).WithError(err).Error("drop database failed")
86 SetExitStatus(1)
87 return
88 }
89 }
90
91 // drop database success
92 ConsoleLog.Infof("drop database %#v success", dsn)
93 return
94}

Callers

nothing calls this directly

Calls 12

ParseDSNFunction · 0.92
DropFunction · 0.92
commonFlagsInitFunction · 0.85
SetExitStatusFunction · 0.85
printCommandHelpFunction · 0.85
ExitFunction · 0.85
configInitFunction · 0.85
waitFunction · 0.85
ErrorMethod · 0.80
WithErrorMethod · 0.80
WithFieldMethod · 0.80
InfofMethod · 0.80

Tested by

no test coverage detected