在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):nfl/graphql-rxjava开源软件地址(OpenSource Url):https://github.com/nfl/graphql-rxjava开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):graphql-rxjavaThis is an execution strategy for graphql-java that makes it easier to use rxjava's Observable. It currently requires Java8. Table of ContentsRx Hello WorldThis is the famous "hello world" in graphql-rxjava: import graphql.schema.GraphQLObjectType;
import graphql.schema.GraphQLSchema;
import graphql.execution.RxExecutionStrategy;
import graphql.execution.RxExecutionResult;
import static graphql.Scalars.GraphQLString;
import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
import static graphql.schema.GraphQLObjectType.newObject;
public class HelloWorld {
public static void main(String[] args) {
GraphQLObjectType queryType = newObject()
.name("helloWorldQuery")
.field(newFieldDefinition()
.type(GraphQLString)
.name("hello")
.staticValue(Observable.just("world")))
.build())
.build();
GraphQLSchema schema = GraphQLSchema.newSchema()
.query(queryType)
.build();
Observable<?> result = ((RxExecutionResult)new GraphQL(schema, new RxExecutionStrategy()).execute("{hello}")).getDataObservable();
result.subscribe(System.out::println);
// Prints: {hello=world}
}
} Getting started with gradleMake sure repositories {
mavenCentral()
}
Dependency: dependencies {
compile 'com.graphql-java:graphql-rxjava:0.0.1'
}
Licensegraphql-rxjava is licensed under the MIT License. See LICENSE for details. Copyright (c) 2015, NFL and Contributors |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论