Il giorno venerdì 5 gennaio 2018 18:09:40 UTC+1, Chris Hopkins ha scritto:
>
> Why not use an interface?
> type TableSaver func (db *DB)
> or
> type TableSaver func (tx *Tx) // depending on your needs
>
>
> Allowing you to:
> func (t *Table) SaveTable (...) {}
>
>
> Which in your example if you w
Why not use an interface?
type TableSaver func (db *DB)
or
type TableSaver func (tx *Tx) // depending on your needs
Allowing you to:
func (t *Table) SaveTable (...) {}
Which in your example if you wanted use a different SaveTable
implementation for OtherTable you could. Otherwise it would ju
Il giorno venerdì 5 gennaio 2018 16:57:04 UTC+1, Ayan George ha scritto:
>
>
>
> On 01/05/2018 10:16 AM, Manlio Perillo wrote:
> > Recently I have developed a few web applications in Go, using a
> > PostgreSQL database, but I have yet understand the best way to use
> > the database/sql package.
On 01/05/2018 10:16 AM, Manlio Perillo wrote:
> Recently I have developed a few web applications in Go, using a
> PostgreSQL database, but I have yet understand the best way to use
> the database/sql package.
>
I don't know how you're serving web pages but I typically use net/http.
This also m
Recently I have developed a few web applications in Go, using a PostgreSQL
database, but I have yet understand the best way to use the database/sql
package.
The simplest method seems to start a transaction in the HTTP handler and
pass a *sql.Tx value to all the functions that need to access the