advsql/insert.go
Timon Ringwald d6e73f69c0 rewrite
2022-07-05 12:38:39 +02:00

16 lines
319 B
Go

package advsql
func Insert[T any](db *Database, query string, exec func(v *T, exec ExecFunc) error) InsertFunc[T] {
s, err := db.prepare(query)
if err != nil {
return nil
}
return func(value *T) error {
return exec(value, func(args ...interface{}) error {
_, err := s.Exec(args...)
return err
})
}
}