我试图在
Scala中链接Futures,但它给了我错误的返回类型.
def getoneRecordByModel(x:DirectFlight): Future[Option[FlightByDetailModel]] = { select.allowFiltering().where(_.from eqs x.from).and(_.to eqs x.to).and(_.departure eqs x.departure).and(_.arrival eqs x.arrival).and(_.carrier eqs x.airline).and(_.code eqs x.flightCode).one() } def getRecordByUUID(x:FlightByDetailModel): Future[Option[FlightByUUIDModel]] = { select.allowFiltering().where(_.uuid eqs x.uuid).one() } def getUUIDRecordByModel(x:DirectFlight): Future[Option[FlightByUUIDModel]] = { getoneRecordByModel(x) andThen { case Success(Some(flight)) => getRecordByUUID(flight) case Success(x) => Success(x) case Failure(x) => Failure(x) } }
但是现在我得到了getUUIDRecordByModel返回类型为Future [Option [FlightByDetailModel]]的错误
如何正确链接它们?