Ejemplo n.º 1
0
func GetUserByAddress(db *periwinkle.Tx, medium string, address string) *User {
	var o User
	result := db.Joins("INNER JOIN user_addresses ON user_addresses.user_id=users.id").Where("user_addresses.medium=? and user_addresses.address=?", medium, address).Find(&o)
	if result.Error != nil {
		if result.RecordNotFound() {
			return nil
		}
		dbError(result.Error)
	}
	o.populate(db)
	return &o
}