From 4346466345aa20de246522f7e36cf0298aee623a Mon Sep 17 00:00:00 2001 From: Timon Ringwald Date: Sat, 9 Jul 2022 23:55:22 +0200 Subject: [PATCH] panic on init error --- insert.go | 2 +- query.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/insert.go b/insert.go index cfcf307..878a531 100644 --- a/insert.go +++ b/insert.go @@ -3,7 +3,7 @@ package advsql func Insert[T any](db *Database, query string, encoder func(v *T, encode EncodeFunc) error) InsertFunc[T] { s, err := db.prepare(query) if err != nil { - return nil + panic(err) } return func(value *T) error { diff --git a/query.go b/query.go index 4aef703..1442c9b 100644 --- a/query.go +++ b/query.go @@ -5,7 +5,7 @@ import "context" func Query[T any](db *Database, query string, decoder func(v *T, decode DecodeFunc) error) QueryManyFunc[T] { s, err := db.prepare(query) if err != nil { - return nil + panic(err) } return func(args ...interface{}) <-chan *T {