Skip to content

Add support for async/await in the lambda expression. #101871

@muazhari

Description

@muazhari

Feature or enhancement

Need support for async/await in the lambda expression.

Pitch

I found meaningful use cases for async lambda in reactive programming. Here is the example code that should be:

async def read_one_by_id(request: ReadOneByIdRequest) -> Content[Account]:
    return rx.just(request).pipe(
        ops.map(async lambda request: await account_repository.read_one_by_id(request.id)),
        ops.map(lambda entity: Content(data=entity, message="Account read one by id succeed.")),
        ops.catch(lambda exception, source: rx.just(
            Content(entity=None, message=f"Account read one by id failed: {exception}")))
    ).run()

Previous discussion

#77628

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions