I plan on building a very simple webapp on Go using it's html/template module for the front end.
One typical function for the app is as follows:
- Get some data from external app
- Display that data in a table in one of the Go templates
- Permit the user to edit certain rows, sort etc.
- Retrieve data from the table to be stored in DB in backend, or sent on to other application.
Very early version of the template looks like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=9">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Delivery App</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous">
</head>
<body>
<div class="container">
<table class="table">
<thead>
<tr>
<th scope="col">Id</th>
<th scope="col">Tran id</th>
<th scope="col">Assembly Instructions</th>
<th scope="col">Miscalleanous</th>
</tr>
</thead>
<tbody>
{{ range . }}
<tr>
<th scope="row">{{.Id}}</th>
<td>{{.TranId}}</td>
<td>{{.Memo}}</td>
<td>{{.AssemblyInstructions}}</td>
<td>{{.AssemblingUnits}}</td>
</tr>
{{ end }}
</tbody>
</table>
</div>
<!-- /container -->
</body>
</html>
I would like to parse data from the table element and store to db, or process further in subsequent request to another service. Can anyone recommend some ways this could be achieved?