1

コマンドで Fluent を使用しようとしていますが、次の問題があります。

このクエリについて:

let location: Location? = try? Location.query(on: context.application.db).filter(\.geId == 123).first().wait()

私は得る: Type of expression is ambiguous without more context"


フィルターを削除すると、すべて問題ありません。

let location: Location? = try? Location.query(on: context.application.db).first().wait()

var を非オプションにすると:

let location: Location = try? Location.query(on: context.application.db).filter(\.geId == 123).first().wait()

私は得る: Cannot convert value of type 'Location?' to specified type 'Location'

同じクエリが、 wait()の代わりにflatMapを使用して Route で機能しています。

だから、私は少し混乱しています。私のエラーはどこですか?

4

1 に答える 1