canonical / sqlair

Friendly type mapping for SQL databases
Apache License 2.0
16 stars 8 forks source link

Add support for nil slices #136

Closed Aflynn50 closed 5 months ago

Aflynn50 commented 5 months ago

The decision was made to allow the empty slice as a valid slice input in SQLair. When the slice is empty no input placeholders are generated for the slice (e.g. ... IN ($S[:]) => ... IN ()).

In Go, the nil slice is often used interchangeably with the empty slice (since append works on both) however, when a nil slice is passed to SQLair, it returns the error "need supported value, got nil".

The behavior for nil slices should match that for empty slices to give a consistent user experience.