Effect CommunityEC
Effect Community•2y ago•
26 replies
Ray

Resolving Kysely Integration Issues in Effect with SqlResolver

Nice to have the very nice Kysely integration in Effect now that DX feels better effect . I ran into this error when trying to use it with SqlResolver 🤯 Proxy Magic Couldn't find the cause of the error, but found that wrapping it in suspend worked temporarily.

 const GetTodoById = yield* Sql.SqlResolver.findById("GetTodoById", {
  Id: Schema.Number,
  Result: Schema.Struct({ id: Schema.Number }),
  ResultId: (data) => data.id,
  // Effect.suspend(() => db.selectFrom("todo").selectAll().where("id", "in", ids)) is works 
  execute: (ids) => db.selectFrom("todo").selectAll().where("id", "in", ids),
})

yield* GetTodoById.execute(TodoId.make(1))
image.png
Was this page helpful?