// Specimen gets an specimen. func specimen(c *cmdapp.Command, db jdh.DB, id string) *jdh.Specimen { sc, err := db.Get(jdh.Specimens, id) if err != nil { fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err)) os.Exit(1) } spe := &jdh.Specimen{} if err := sc.Scan(spe); err != nil { if err == io.EOF { return &jdh.Specimen{} } fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err)) os.Exit(1) } return spe }
// Taxon gets a taxon. func taxon(c *cmdapp.Command, db jdh.DB, id string) *jdh.Taxon { sc, err := db.Get(jdh.Taxonomy, id) if err != nil { fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err)) os.Exit(1) } tax := &jdh.Taxon{} if err := sc.Scan(tax); err != nil { if err == io.EOF { return &jdh.Taxon{} } fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err)) os.Exit(1) } return tax }
// Phylogeny gets a phylogeny. func phylogeny(c *cmdapp.Command, db jdh.DB, id string) *jdh.Phylogeny { sc, err := db.Get(jdh.Trees, id) if err != nil { fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err)) os.Exit(1) } phy := &jdh.Phylogeny{} if err := sc.Scan(phy); err != nil { if err == io.EOF { return &jdh.Phylogeny{} } fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err)) os.Exit(1) } return phy }
// PhyloNode gets a node. func phyloNode(c *cmdapp.Command, db jdh.DB, id string) *jdh.Node { sc, err := db.Get(jdh.Nodes, id) if err != nil { fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err)) os.Exit(1) } nod := &jdh.Node{} if err := sc.Scan(nod); err != nil { if err == io.EOF { return &jdh.Node{} } fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err)) os.Exit(1) } return nod }
// Dataset gets a dataset. func dataset(c *cmdapp.Command, db jdh.DB, id string) *jdh.Dataset { sc, err := db.Get(jdh.Datasets, id) if err != nil { fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err)) os.Exit(1) } set := &jdh.Dataset{} if err := sc.Scan(set); err != nil { if err == io.EOF { return &jdh.Dataset{} } fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err)) os.Exit(1) } return set }
// Raster gets the raster distribution. func raster(c *cmdapp.Command, db jdh.DB, id string) *jdh.Raster { sc, err := db.Get(jdh.RasDistros, id) if err != nil { fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err)) os.Exit(1) } ras := &jdh.Raster{} if err := sc.Scan(ras); err != nil { if err == io.EOF { return &jdh.Raster{} } fmt.Fprintf(os.Stderr, "%s\n", c.ErrStr(err)) os.Exit(1) } return ras }