Пример #1
0
// UnmarshalJSON uses the defining string.
func (d *Id) SetBSON(raw bson.Raw) error {
	var def string
	err := raw.Unmarshal(&def)
	if err == nil {
		*d = MakeId(def)
	}
	return err
}
Пример #2
0
func (self *DynamicChoice) SetBSON(raw bson.Raw) (err error) {
	var s string
	err = raw.Unmarshal(&s)
	if err != nil {
		return err
	}
	return self.SetString(s)
}
Пример #3
0
// UnmarshalJSON uses the defining string.
func (l *Length) SetBSON(raw bson.Raw) error {
	var def string
	err := raw.Unmarshal(&def)
	if err == nil {
		*l, err = LengthFromString(def)
	}
	return err
}
Пример #4
0
// Implements bson.Setter
func (self *Ref) SetBSON(raw bson.Raw) error {
	var id *bson.ObjectId
	err := raw.Unmarshal(&id)
	if err != nil {
		return err
	}
	if id == nil {
		self.ID = ""
	} else {
		self.ID = *id
	}
	return nil
}