-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
(Proposal)
I think the position information is relevant for columns and could be added to the analyser.
But thank to the extensibility 👍 of the analyser, it can be added without changing lobos.
(def db
{:subprotocol "mysql"
:user "admin"
:password "mypass"
:subname "//docker:3306/mydb"})
(require '[lobos.schema] '[lobos.analyzer :as an])
(defmethod an/analyze [:mysql lobos.schema.Column] [_ column-meta]
(let [std (get-method an/analyze [:lobos.analyzer/standard lobos.schema.Column])
std-analyzed (std _ column-meta)]
(assoc std-analyzed :position (:ordinal_position column-meta))))
(->> (an/analyze-schema db) :tables first second :columns first second keys)
;#=> (:cname :data-type :default :auto-inc :not-null :others :position)jprudent
Metadata
Metadata
Assignees
Labels
No labels