summaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/nutrient.rkt9
1 files changed, 7 insertions, 2 deletions
diff --git a/models/nutrient.rkt b/models/nutrient.rkt
index 10e274e..944583e 100644
--- a/models/nutrient.rkt
+++ b/models/nutrient.rkt
@@ -1,12 +1,14 @@
#lang racket
(provide
- ;; Struct definitions
+ ;; Model struct
nutrient
nutrient?
nutrient-id nutrient-name nutrient-formula
- ;; SQL CRUD
+ ;; Contracts
+ nutrient-value-pair/c
(contract-out
+ ;; SQL CRUD
[create-nutrient! (-> string? string? nutrient?)]
[get-nutrients (-> (listof nutrient?))]
[get-nutrient (->* ()
@@ -33,6 +35,9 @@
(nutrient-id v)
(nutrient-name v))))
+(define nutrient-value-pair/c
+ (cons/c nutrient? (and/c real? (>=/c 0))))
+
;; CREATE
Copyright 2019--2026 Marius PETER