// 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 }
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) }
// 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 }
// 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 }