Skip to content

Instantly share code, notes, and snippets.

@dsandip
Last active January 11, 2019 18:18
Show Gist options
  • Save dsandip/deae2a7c3d8f7407dcd27c6cd4746281 to your computer and use it in GitHub Desktop.
Save dsandip/deae2a7c3d8f7407dcd27c6cd4746281 to your computer and use it in GitHub Desktop.
Test data for custom functions docs

Insert data into tables:

Table: landmark

Mutation:

mutation insertLandmark($objects: [landmark_insert_input!]!) {
    insert_landmark(objects: $objects) {
         returning{
           id
           name
           location
           type
         }
    }
}

Mutation-variable

{
     "objects": [
       {
         "name": "Arno",
         "type": "river",
         "location": {
           "type": "Point",
           "coordinates":[43.75049, 11.03207]
         }
       },
       {
         "name": "Giardino Bardini",
         "type": "park",
         "location": {
           "type": "Point",
           "coordinates": [43.76417, 11.25869]
         }
       },{
         "name": "blue tokai",
         "type": "coffee shop",
         "location": {
           "type": "Point",
           "coordinates":[12.9743387, 77.6030891]
         }
       },
       {
         "name": "Bangalore",
         "type": "city",
         "location": {
           "type": "Point",
           "coordinates": [12.9716, 77.5946]
         }
       }
     ]
}

Table: user_location

Mutation

mutation insertUserLocation($user_location_objects: [user_location_insert_input!]!) {
    insert_user_location(objects: $user_location_objects) {
        returning{
            location
            user_id
        }
    }
}

Mutation-variable

{
 "user_location_objects": [
   {
     "user_id": 1,
     "location": {
       "type": "Point",
       "coordinates": [34.75049, 10.03207]
     }
   },
   {
     "user_id": 2,
     "location": {
       "type": "Point",
       "coordinates": [12.75049, 34.03207]
     }
   },{
     "user_id": 3,
     "location": {
       "type": "Point",
       "coordinates": [12.9406589, 77.6185572]
     }
   },
   {
     "user_id": 4,
     "location": {
       "type": "Point",
       "coordinates": [12.939553, 77.6183303]
     }
   }
 ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment