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 wanted use a different SaveTable  
> implementation for OtherTable you could. Otherwise it would just inherit it 
> from Table.
> Or am I missing something here?
>
>
Because the two TableSaver function code is (literally) the same, the only 
difference is the input variable.
Isn't it better for the database connection to be an interface?

> [...]


Thanks
Manlio Perillo 

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to