aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/plan.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/plan.go b/internal/plan.go
index 8fc24d8..f738278 100644
--- a/internal/plan.go
+++ b/internal/plan.go
@@ -46,9 +46,16 @@ var (
// BuildPlan creates a new plan for the given struct type.
func BuildPlan(t reflect.Type, dialect Dialect) (Plan, error) {
+ p, err := buildPlan(t, dialect)
+ if err != nil {
+ return Plan{}, fmt.Errorf("cannot use type %s.%s for queries: %w", t.PkgPath(), t.Name(), err)
+ }
+ return p, nil
+}
+
+func buildPlan(t reflect.Type, dialect Dialect) (Plan, error) {
if t.Kind() != reflect.Struct {
- return Plan{}, fmt.Errorf("expected record type to be a struct, but got kind %s (full type: %s.%s)",
- t.Kind(), t.PkgPath(), t.Name())
+ return Plan{}, fmt.Errorf("expected struct type, but got kind %s", t.Kind().String())
}
var p = Plan{