func (c *dbCmd) Main() { c.configuredCmd.Main() InitLog() var db *openpgp.DB var err error if db, err = openpgp.NewDB(); err != nil { die(err) } // Ensure tables all exist if c.crTables { if err = db.CreateTables(); err != nil { die(err) } } // Drop constraints if c.drConstraints { // Create all constraints if err = db.DropConstraints(); err != nil { die(err) } } // De-duplication option if c.dedup { if err = db.DeleteDuplicates(); err != nil { die(err) } } // Create all constraints if c.crConstraints { if err = db.CreateConstraints(); err != nil { die(err) } } }
func (ec *deleteCmd) Main() { if ec.keyHash == "" { Usage(ec, "--keyHash is required") } keyHash, err := hex.DecodeString(ec.keyHash) if err != nil { die(err) } ec.configuredCmd.Main() InitLog() var db *openpgp.DB if db, err = openpgp.NewDB(); err != nil { die(err) } // Ensure tables all exist if err = db.CreateTables(); err != nil { die(err) } var ptree recon.PrefixTree reconSettings := recon.NewSettings(openpgp.Config().Settings.TomlTree) if ptree, err = openpgp.NewSksPTree(reconSettings); err != nil { die(err) } // Create the prefix tree (if not exists) if err = ptree.Create(); err != nil { die(err) } // Ensure tables all exist if err = db.CreateTables(); err != nil { die(err) } if err = ptree.Remove(symflux.Zb(symflux.P_SKS, keyHash)); err != nil { die(err) } log.Println(ec.keyHash, "deleted from prefix tree") }