How to streaming for download csv?

I would like to query data from database and mapping data then streaming CSV file via http. How can I do like that? I try like this but I got filename “export” into directory. Any idea?

   func (resource Resource) export(c echo.Context) error {
    	c.Response().Header().Set("Content-Type", "application/octet-stream")
    	c.Response().Header().Set("Content-Disposition", "attachment; filename="+"my_result.csv")
    	c.Response().Header().Set("Content-Transfer-Encoding", "binary")
    	c.Response().Header().Set("Expires", "0")
    	c.Response().WriteHeader(http.StatusOK)

	    var w *csv.Writer

    	for _, record := range records {
    		w = csv.NewWriter(c.Response())
    		if err := w.Write(record); err != nil {
    			log.Fatalln("error writing record to csv:", err)
    		}
    		w.Flush()
    		c.Response().Flush()
    		time.Sleep(1 * time.Second)
    	}
    	return nil
    }

The following code works for me:

package main

import (
	"encoding/csv"
	"net/http"

	"github.com/labstack/echo"
)

var records = [][]string{
	{"first_name", "last_name", "username"},
	{"Rob", "Pike", "rob"},
	{"Ken", "Thompson", "ken"},
	{"Robert", "Griesemer", "gri"},
}

func main() {
	e := echo.New()
	e.GET("/", func(c echo.Context) (err error) {
		res := c.Response()
		w := csv.NewWriter(res)
		header := res.Header()
		header.Set(echo.HeaderContentType, echo.MIMEOctetStream)
		header.Set(echo.HeaderContentDisposition, "attachment; filename="+"result.csv")
		header.Set("Content-Transfer-Encoding", "binary")
		header.Set("Expires", "0")
		res.WriteHeader(http.StatusOK)

		for _, record := range records {
			if err = w.Write(record); err != nil {
				return
			}
			w.Flush()
		}

		return
	})
	e.Logger.Fatal(e.Start(":1323"))
}