diff options
| author | Marius Peter <dev@marius-peter.com> | 2025-11-13 16:15:05 +0100 |
|---|---|---|
| committer | Marius Peter <dev@marius-peter.com> | 2025-11-13 16:15:05 +0100 |
| commit | 7b09445140983623173203c4594bb54dcd55fe1e (patch) | |
| tree | 855bab6b634130367cc22a22a9fc52e755ab2c0e /models/nutrient.rkt | |
| parent | 36b3bd1009e5cbd8545b6abbb5988c00d7274c15 (diff) | |
Add nutrient-value-pair/c contract.
Diffstat (limited to 'models/nutrient.rkt')
| -rw-r--r-- | models/nutrient.rkt | 9 |
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 |