という名前の MySQL フィールドがありますが、コード内のthing_id
ように参照したいと考えて:thing-id
います。次のようなエンティティを定義できます。
(defentity thing
(entity-fields :id [:thing_id :thing-id]))
私が物事をフェッチするとき:
(select thing)
アンダースコアを含む MySQL フィールドは次のように変換されます。
[{:id 1 :thing-id 2}]
しかし、エイリアスで選択することはできません:
(select thing (where (= :thing-id 2)))
与える
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
Unknown column 'thing.thing-id' in 'where clause'
where
各呼び出しで修正できます:
(select thing (where (= :thing_id 2)))
しかし、エイリアスが両方の方法で機能することを望んでいました。そうは見えません。で使用できるエイリアスを設定する方法はありselect
ますか?