I'm coming to Go from Meteor.js, which, while full of awesome features, is a little too black-box-y for my taste. One of the awesome things about Meteor was blaze, which made their templating engine reactive; database changes were propagated to the UI immediately.
In Go, though, no such solution seems to exist, aside from maybe trying to integrate React. Is there a good way of making Go's templates (things like {{range}} and stuff) reactive, so that they respond to database changes instantly?
What we have right now, for context, is something like this (in JS):
$(".delete-button").click(function (e) {
obj = $(this).closest(".object");
id = $(obj).data("id");
$("[data-id=" + id + "]").hide();
// try to delete the element from the table
database.delete(id, function (err) {
if (err) {
$("[data-id=" + id + "]").show();
log(err);
return;
}
});
});
This is fine, but it's kind of frustrating for more nuanced things, like editing. Any ideas or help would be really appreciated.
No, don't confuse rendering templates on server side with running code in the browser and modifying the DOM. The only way to update the rendered template is to refresh whole page, unless you inject some JS code there.
Worth taking a look at Hugo.
It's a static site generator written in go which which supports LiveReload, as you've described. It's lightening fast.