Exemplo n.º 1
0
Arquivo: pt.go Projeto: hagna/pt
func (t *Tree) Get(ro *levigo.ReadOptions, id int) (*Node, error) {
	if ro == nil {
		ro = levigo.NewReadOptions()
		defer ro.Close()
	}
	b := int2b(id)
	dat, err := t.DB.Get(ro, b)
	if err != nil {
		return nil, err
	}
	res := new(Node)
	json.Unmarshal(dat, res)
	return res, nil

}