Re: [go-nuts] How to handle large amount of data on the frontend using go template and cassandraDB?

2020-08-13 Thread Mhd Shulhan
Pada tanggal Kam, 13 Agu 2020 23.21,  menulis:

>
> https://stackoverflow.com/questions/63393803/how-to-handle-large-amount-of-data-on-the-frontend-using-go-template-and-cassand?noredirect=1#comment112097067_63393803
>
> I am using *golang* to load data from CassandraDB and send it to the view
> component, but it takes almost *2min to load 20k rows of data which is
> not good for the end-user*.
>
> how to handle this amount of data faster?
>
> This is just an example :
>
> server.go
>
> ...
>
> var tpl = template.Must(template.ParseFiles("index.html"))
>
> func indexHandler(w http.ResponseWriter, r *http.Request) {
>
>  day:=[]string{"Mon","tue","wed","friday"} // huge data from cassandraDB
>  tpl.Execute(w, day)
> }
>
>
> ...
>
>
> index.html
>
>
> {{range .}}
>
> {{.}} 
>
> {{ end}}
>

Have you try by not using template? Probably bytes.Buffer with loop on dara
and manual anchor tags.

>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMh9%2BYC9ALYK8tZ1pQEMKZ%2BGLrW3n9QYeLiE55v-76pL%3D4_w0g%40mail.gmail.com.


[go-nuts] How to handle large amount of data on the frontend using go template and cassandraDB?

2020-08-13 Thread xdxx2017
https://stackoverflow.com/questions/63393803/how-to-handle-large-amount-of-data-on-the-frontend-using-go-template-and-cassand?noredirect=1#comment112097067_63393803

I am using *golang* to load data from CassandraDB and send it to the view 
component, but it takes almost *2min to load 20k rows of data which is not 
good for the end-user*.

how to handle this amount of data faster?

This is just an example :

server.go

...

var tpl = template.Must(template.ParseFiles("index.html"))

func indexHandler(w http.ResponseWriter, r *http.Request) {

 day:=[]string{"Mon","tue","wed","friday"} // huge data from cassandraDB
 tpl.Execute(w, day)
}


...


index.html


{{range .}}
 
{{.}} 
 
{{ end}} 


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/77f4a828-a569-4eec-b461-9048f47808b0o%40googlegroups.com.