Skip to content

Latest commit

 

History

History
71 lines (55 loc) · 1.11 KB

setup_postgraphile.md

File metadata and controls

71 lines (55 loc) · 1.11 KB
# Install
npm install -g postgraphile @graphile/pg-aggregates

# Run
postgraphile --append-plugins @graphile/pg-aggregates --enhance-graphiql -c postgresql://postgres:[email protected]:5432/discorddata


postgraphile --append-plugins @graphile/pg-aggregates,$(pwd)/graphile_time_queries.js --enhance-graphiql -c postgresql://postgres:[email protected]:5432/discorddata
curl 'http://localhost:5000/graphql' \
  -X POST \
  -H 'content-type: application/json' \
  --data '{"query": "query MyQuery { allGuildsTs { nodes { id guildName } } }"}'

Example postgraphile queries

{
  allChannelsTs{
    nodes {
      id,
      channelName,
      guildId,
      guildsTByGuildId{
        id,
        guildName
      }
    }
  }
}
query MyQuery {
  allGuildsTs {
    aggregates {
      distinctCount {
        id
      }
    }
  }
  allMessagesTs {
    aggregates {
      distinctCount {
        id
      }
    }
  }
  allChannelsTs {
    aggregates {
      distinctCount {
        id
      }
    }
  }
}