diff options
| author | Marius Peter <dev@marius-peter.com> | 2025-11-02 19:41:25 +0100 | 
|---|---|---|
| committer | Marius Peter <dev@marius-peter.com> | 2025-11-02 19:41:25 +0100 | 
| commit | d193f463088d2e120f5e236afd0ddfda8e30c6d8 (patch) | |
| tree | 98bb758163a75292c554b1c392f3bc08cd7c7f5e /models/fertilizer-product.rkt | |
| parent | 1b23eec4517a8628a9564c9ed25923e6c9ea5bd8 (diff) | |
Add guard function to prevent null SQL values from leaking out.
Diffstat (limited to 'models/fertilizer-product.rkt')
| -rw-r--r-- | models/fertilizer-product.rkt | 6 | 
1 files changed, 6 insertions, 0 deletions
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))  |