This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { FeedGQL } from './generated/graphql'; | |
| @Component({...}) | |
| export class FeedComponent { | |
| constructor(private feedGQL: FeedGQL) {} | |
| ngOnInit() { | |
| this.feedGQL.valueChanges.subscribe(result => { | |
| console.log(result.data); | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable } from '@angular/core'; | |
| import { Query } from 'apollo-angular'; | |
| import gql from 'graphql-tag'; | |
| @Injectable({...}) | |
| export class FeedGQL extends Query { | |
| document = gql` | |
| query Feed { | |
| posts { | |
| id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component } from '@angular/core'; | |
| import { FeedGQL } from './feed-gql.ts'; | |
| @Component({ … }) | |
| export class FeedComponent { | |
| constructor(feedGQL: FeedGQL) { | |
| feedGQL.watch() | |
| .valueChanges | |
| .subscribe(result => { | |
| // ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| query Feed { | |
| posts { | |
| id | |
| title | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # import B from "b.graphql" | |
| type A { | |
| # test 1 | |
| first: String | |
| second: Float | |
| b: B | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type User @entity { | |
| id: String @id | |
| username: String! @column | |
| email: @column | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ObjectID } from 'mongodb'; | |
| export interface UserDbObject { | |
| _id: ObjectID; | |
| username: string; | |
| email?: string | null; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Collection } from 'mongodb'; | |
| import { db } from './my-db-instance'; | |
| const MyCollection: Collection<UserDbObject> = db.collection<UserDbObject>('users'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type User @entity { | |
| id: String @id | |
| username: String! @column @map(path: "profile.credentials.username") | |
| email: @column | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ObjectID } from 'mongodb'; | |
| export interface UserDbObject { | |
| _id: ObjectID; | |
| profile { | |
| credentials: { | |
| username: string; | |
| }; | |
| }; | |
| email?: string | null; |