Exemple #1
0
// 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
}
Exemple #2
0
// 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
}
Exemple #3
0
// 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
}
Exemple #4
0
// 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
}
Exemple #5
0
// 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
}
Exemple #6
0
// 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
}