From d193f463088d2e120f5e236afd0ddfda8e30c6d8 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 2 Nov 2025 19:41:25 +0100 Subject: Add guard function to prevent null SQL values from leaking out. --- models/fertilizer-product.rkt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/models/fertilizer-product.rkt b/models/fertilizer-product.rkt index 0a6c03d..b93f082 100644 --- a/models/fertilizer-product.rkt +++ b/models/fertilizer-product.rkt @@ -32,6 +32,12 @@ ;; Instances of this struct are persisted in the fertilizer_products table. (struct fertilizer-product (id canonical-name nutrient-values brand-name) #:transparent + #:guard + (λ (id canonical-name nutrient-values brand-name _) + (values id + canonical-name + nutrient-values + (if (sql-null? brand-name) #f brand-name))) #:property prop:custom-write (λ (v out _mode) (fprintf out "Fertilizer #~a\n" (fertilizer-product-id v)) -- cgit v1.2.3