Re: [go-nuts] db interface design

2018-05-21 Thread yang sheng
On Monday, May 21, 2018 at 3:47:59 AM UTC-4, Sergey Kamardin wrote: > > > 1. there are a lot of similar functions, for example NewBook and > NewAuthor. > > The difference is type of argument passed into the function. Is it a > good > > idea to combine those 2 functions with a generic

Re: [go-nuts] db interface design

2018-05-21 Thread Sergey Kamardin
> 1. there are a lot of similar functions, for example NewBook and NewAuthor. > The difference is type of argument passed into the function. Is it a good > idea to combine those 2 functions with a generic New(interface{}) (string, > error) function and reflect the actual type inside? I would

[go-nuts] db interface design

2018-05-20 Thread yang sheng
Hi I am trying to practice golang and have some questions regarding to interface design. Say I want to create a simple app to store the book and its author info. I am planning to create interfaces so that I can use different db driver (mysql/mongo/redis...) as long as if they implemented DB