func (p *postgres) SearchAvailabilityByDatesByLaptopID(start, end time.Time, laptopID int) (bool, error) {
	ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
	defer cancel()

	query := `SELECT Count(id) FROM laptop_restrictions
		      WHERE laptop_id = $1 and $2 < end_date and $3 > start_date`

	var numRows int
	row := p.DB.QueryRowContext(ctx, query, laptopID, start, end)
	err := row.Scan(&numRows)
	if err != nil {
		return false, err
	}

	if numRows == 0 {
		return true, nil
	}

	return false, nil
}
// SearchAvailabilityByDatesLaptopID returns true if availability exists for laptop id, and false if no availability exists
SearchAvailabilityByDatesLaptopID returns true if availability exists for laptop id, and false if no availability exists
// SearchAvailabilityByDatesLaptopID returns true if availability exists for laptop id and false if no availability exists
func (p *postgres) SearchAvailabilityByDatesByLaptopID(start, end time.Time, laptopID int) (bool, error) {
	ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
	defer cancel()
	query := `SELECT Count(id) FROM laptop_restrictions
		      WHERE laptop_id = $1 and $2 < end_date and $3 > start_date`
	var numRows int
	row := p.DB.QueryRowContext(ctx, query, laptopID, start, end)
	err := row.Scan(&numRows)
	if err != nil {
		return false, err
	}
	if numRows == 0 {
		return true, nil
	}
	return false, nil
}
func ( p * postgres ) SearchAvailabilityByDatesByLaptopID ( start , end time . Time , laptopID int ) ( bool , error ) { ctx , cancel := context . WithTimeout ( context . Background ( ) , 3 * time . Second ) defer cancel ( ) query := `SELECT Count(id) FROM laptop_restrictions
		      WHERE laptop_id = $1 and $2 < end_date and $3 > start_date` var numRows int row := p . DB . QueryRowContext ( ctx , query , laptopID , start , end ) err := row . Scan ( & numRows ) if err != nil { return false , err } if numRows == 0 { return true , nil } return false , nil }
SearchAvailabilityByDatesLaptopID returns true if availability exists for laptop id, and false if no availability exists
SearchAvailabilityByDatesLaptopID returns true if availability exists for laptop id and false if no availability exists