[Racket] Ferti hydroponic nutrient solver, redux.
Add guard function to prevent null SQL values from leaking out.
models/fertilizer-product.rkt
@@ -32,6 +32,12 @@
32
32
;; Instances of this struct are persisted in the fertilizer_products table.
33
33
(struct fertilizer-product (id canonical-name nutrient-values brand-name)
34
34
#:transparent
35
Added:
#:guard
36
Added:
(λ (id canonical-name nutrient-values brand-name _)
37
Added:
(values id
38
Added:
canonical-name
39
Added:
nutrient-values
40
Added:
(if (sql-null? brand-name) #f brand-name)))
35
41
#:property prop:custom-write
36
42
(λ (v out _mode)
37
43
(fprintf out "Fertilizer #~a\n" (fertilizer-product-id v))