Beispiel #1
0
func (us *users) get(start int) error {
	m, err := us.BI.BB.getManyBytes(start, cap(us.s))
	if err != nil {
		return err
	}

	ct := -1
	for k, v := range m {
		ct++
		br := bytes.NewReader(v)
		dec := gob.NewDecoder(br)
		tmp := &user{
			User: datatypes.NewUser(),
			boltItem: &boltItem{
				BB:  us.BI.BB,
				BBI: us.BI.BB,
			},
		}
		if err := dec.Decode(tmp); err != nil {
			return err
		}
		us.s[ct] = tmp
		us.s[ct].ID = k
	}
	return nil
}
Beispiel #2
0
func (n *node) newUser() *user {
	u := &user{
		User: datatypes.NewUser(),
		boltItem: &boltItem{
			BB:  n.u.ds.dcbUsers,
			BBI: n.u.ds.dcbIndUsers,
		},
	}
	return u
}