Skip to content

Commit

Permalink
Implement parser lookup in parse-row
Browse files Browse the repository at this point in the history
  • Loading branch information
verberktstan authored Jan 31, 2024
1 parent f400d01 commit 6aaa44f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/swark/eav.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@
(assert-ifn-vals props)
(->> row
(zipmap keyseq)
(merge-with parse props)))))
(merge-with parse props))))
([props lookup row] ;TODO: Merge lookop into props?
(let [m (parse-row props row)
ea-parser (get lookup :entity/attribute identity)
eaa (juxt (comp ea-parser :entity/attribute) :attribute)
value-parser (get lookup (eaa m))]
(cond-> m
ea-parser (update:entity/attribute ea-parser)
value-parser (update :value value-parser)))))

(defn parser
[props]
Expand Down

0 comments on commit 6aaa44f

Please sign in to comment.