Skip to content

Method In can't accept a slice #1

@petersunbag

Description

@petersunbag
// In represents "field IN (value...)".  
func (c *Cond) In(field string, value ...interface{}) string {
func GetByIds(ids []int64) (err error) {
	sb :=sqlbuilder.NewSelectBuilder()
	sb.Select("*")
	sb.From(tableName)
	sb.Where(
		sb.In("delivery_id", deliveryIds...),
	)

make error is

cannot use deliveryIds (type []int64) as type []interface {} in argument to sb.Cond.In

It seems the only way is to do a for-loop to transfer the deliveryIds to a []interface {}, but it is ugly.
Maybe method In can the do this transfer.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions