func (u *URL) SetBSON(raw bson.Raw) error {
	if raw.Kind == 10 {
		return bson.SetZero
	}
	var s string
	err := raw.Unmarshal(&s)
	if err != nil {
		return err
	}
	url, err := ParseURL(s)
	if err != nil {
		return err
	}
	*u = *url
	return nil
}
// SetBSON turns u into a bson.Setter so it can be loaded directly
// from a MongoDB database with mgo.
//
// TODO (stickupkid): This should not be here, as this is purely for mongo
// data stores and that should be implemented at the site of data store, not
// dependant on the library.
SetBSON turns u into a bson.Setter so it can be loaded directly
from a MongoDB database with mgo.


// SetBSON turns u into a bson . Setter so it can be loaded directly // from a MongoDB database with mgo . // // TODO ( stickupkid ) : This should not be here as this is purely for mongo // data stores and that should be implemented at the site of data store not // dependant on the library .
func (u *URL) SetBSON(raw bson.Raw) error {
	if raw.Kind == 10 {
		return bson.SetZero
	}
	var s string
	err := raw.Unmarshal(&s)
	if err != nil {
		return err
	}
	url, err := ParseURL(s)
	if err != nil {
		return err
	}
	*u = *url
	return nil
}
func ( u * URL ) SetBSON ( raw bson . Raw ) error { if raw . Kind == 10 { return bson . SetZero } var s string err := raw . Unmarshal ( & s ) if err != nil { return err } url , err := ParseURL ( s ) if err != nil { return err } * u = * url return nil }
SetBSON turns u into a bson.Setter so it can be loaded directly
from a MongoDB database with mgo.
SetBSON turns u into a bson . Setter so it can be loaded directly from a MongoDB database with mgo .