https://github.com/blckclov3r/hasuragraphql_testcode
https://github.com/blckclov3r/hasuragraphql_testcode
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/blckclov3r/hasuragraphql_testcode
- Owner: blckclov3r
- License: mit
- Created: 2022-10-14T02:23:26.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-29T02:17:55.000Z (over 3 years ago)
- Last Synced: 2025-08-12T06:56:41.806Z (11 months ago)
- Language: HTML
- Size: 294 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
# Hasura
> The Hasura GraphQL Engine is an extremely lightweight, high performance product that gives you instant realtime GraphQL APIs on a Postgres database. This can be used to quickly build new applications on Postgres or fast-track the move to GraphQL for existing applications on Postgres.
## Example
[Hasura Crash Course by Laith Academy][1]
### Mutation Insert
```
mutation{
insert_posts(objects:{
content:"This is my mutation posts",
title: "My mutation",
user_id: 1
}){
returning{
title
user {
username
}
}
}
}
```
### Mutation Update
```
mutation{
update_users_by_pk(pk_columns:{id:1}, _set: {
age: 99
}){
id
username
}
}
```
### Mutation Delete
```
mutation{
delete_users_by_pk(id: 5){
id
username
}
}
```
### Select All
```
query{
users{
id
username
}
}
```
### Select and Where clase
```
query{
users(where: {gender:{_eq: false}}) {
id
username
}
}
```
### Search by primary key
```
query{
users_by_pk(id: 1){
username
posts{
title
content
id
},
comments{
content
id
}
}
}
```
```
{
posts_by_pk(id: 1){
title
content
comments(order_by: {id: desc}){
id
content
user{
username
}
}
}
}
```
[1]:https://www.youtube.com/watch?v=BNo0WROmij8
-----
HackMD Note URL: https://hackmd.io/Wux1wxsPRe2nAWa78tf93g