[go-nuts] Re: Variadic Arguments and Interfaces

2020-05-17 Thread Saied Seghatoleslami
I found this article by Nick Gauthier from 2016. https://www.meetspaceapp.com/2016/05/23/writing-a-data-mapper-in-go-without-an-orm.html. The original idea is contributed to Martin Fowler. Someone else has solved this problem before. On Friday, September 7, 2012 at 4:45:07 PM UTC-4, Paddy

Re: [go-nuts] Re: Variadic Arguments and Interfaces

2020-05-17 Thread Saied Seghatoleslami
I have it working well by listing the individual conditions. But I have a bunch of functions that do similar things (authenticate a user based on their email and password, get a list of users based on role and active status, get an individual user based on ID, etc.) and I was looking to combin

Re: [go-nuts] Re: Variadic Arguments and Interfaces

2020-05-17 Thread Steven Hartland
Did you use the correct calling convension e.g. db.Query(query, cond...) The ... makes the slice variadic, passing echData.Active, exchData.Role instead of just a interface slice On 17/05/2020 23:27, Saied Seghatoleslami wrote: I hate to dig up something from 2012, but I have come across a sim

[go-nuts] Re: Variadic Arguments and Interfaces

2020-05-17 Thread Saied Seghatoleslami
I hate to dig up something from 2012, but I have come across a similar issue where I can use an explanation. The signature of the Query function in the sql package is: func (db *DB ) Query(query string , args ...i