2

という名前の 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ますか?

4

1 に答える 1