Better model pointers

This commit is contained in:
Hein
2025-11-07 13:45:08 +02:00
parent f518a3c73c
commit 2e9a0bd51a
2 changed files with 14 additions and 11 deletions

View File

@@ -201,8 +201,9 @@ func (h *Handler) handleRead(ctx context.Context, w common.ResponseWriter, id st
logger.Info("Reading records from %s.%s", schema, entity)
// Use Table() with the resolved table name (don't use Model() as it would add the table twice)
query := h.db.NewSelect().Table(tableName)
// Use Table() with the resolved table name and Model() for Bun compatibility
// Bun requires Model() to be set for Count() and Scan() operations
query := h.db.NewSelect().Model(modelPtr).Table(tableName)
// Apply column selection
if len(options.Columns) > 0 {