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

35 views
Skip to first unread message

xdxx...@gmail.com

unread,
Aug 13, 2020, 12:21:25 PM8/13/20
to golang-nuts
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 .}}
 
<a>{{.}}</a> <!--Dispay 20k of data-->
 
{{ end}}

Mhd Shulhan

unread,
Aug 13, 2020, 12:36:07 PM8/13/20
to xdxx...@gmail.com, golang-nuts
Have you try by not using template? Probably bytes.Buffer with loop on dara and manual anchor tags.
Reply all
Reply to author
Forward
0 new messages