You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: post_query.rb
    path of file: ./repos/repost/app/queries
    
    the code of the file until where you have to start completion: class PostQuery
  def initialize(posts = Post.all)
    @posts = posts
  end

  def with_action_by(user)
    posts.select(
      <<~SQL
        posts.*,
        CASE
          WHEN EXISTS (
            SELECT TRUE
            FROM reactions
            WHERE reactions.post_id = posts.id A
    
  def with_action_by(user)
    posts.select(
      <<~SQL
        posts.*,
        CASE
          WHEN EXISTS (
            SELECT TRUE
            FROM reactions
            WHERE reactions.post_id = posts.id AND reactions.user_id = #{user.id}
          ) THEN TRUE
          ELSE FALSE
        END AS reacted,
        CASE
          WHEN EXISTS (
            SELECT TRUE
            FROM stars
            WHERE stars.post_id = posts.id AND stars.user_id = #{user.id}
          ) THEN TRUE
          ELSE FALSE
        END AS starred
      SQL
    )
  end