gorm icon indicating copy to clipboard operation
gorm copied to clipboard

Support go1.23 iterators

Open ilya-hontarau opened this issue 1 year ago • 0 comments

Describe the feature

Allow to pass iterators in methods:

db.Delete(&User, "name  IN (?)", maps.Keys(namesToIDs))

users := []User{{Name: "jinzhu1"}, {Name: "jinzhu2"}, {Name: "jinzhu3"}}
err = db.Create(slices.Values(users)).Error

not it returns errors:

panic: failed to encode args[0]: unable to encode (iter.Seq[string])(0x102f20cf0) into text format for text (OID 25): cannot find encode plan

or 

panic: unsupported data type: iter.Seq[main.Test]: Table not set, please set it like: db.Model(&user) or db.Table("users")

Motivation

Support new go standard library features.

Related Issues

ilya-hontarau avatar Sep 09 '24 11:09 ilya-hontarau