在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):neomatrixcode/Diana.jl开源软件地址(OpenSource Url):https://github.com/neomatrixcode/Diana.jl开源编程语言(OpenSource Language):Julia 100.0%开源软件介绍(OpenSource Introduction):Diana.jl
A Julia GraphQL client/server implementation.
Contributions welcomed!This repository is an implementation of a GraphQL server, a query language for API created by Facebook. See more complete documentation at http://graphql.org/ Looking for help? Find resources from the community. Getting StartedAn overview of GraphQL in general is available in the README for the Specification for GraphQL. This package is intended to help you building GraphQL schemas/types fast and easily.
InstallationPkg> add Diana
#Release
pkg> add Diana#master
#Development ExamplesClientquery = """
{
neomatrix{
nombre
linkedin
}
}
"""
r = Queryclient("https://neomatrix.herokuapp.com/graphql",query) client = GraphQLClient("https://api.graph.cool/simple/v1/movies",auth="Bearer my-jwt-token")
query2 = """
query getMovie(\$title: String!) {
Movie(title:\$title) {
releaseDate
actors {
name
}
}
}
"""
r = client.Query(query2,vars=Dict("title" => "Inception"))
r.Data
# "{\"data\":{\"Movie\":{\"releaseDate\":\"2010-08-28T20:00:00.000Z\",\"actors\":[{\"name\":\"Leonardo DiCaprio\"},{\"name\":\"Ellen Page\"},{\"name\":\"Tom Hardy\"},{\"name\":\"Joseph Gordon-Levitt\"},{\"name\":\"Marion Cotillard\"}]}}}"
ServerHere is one example for you to get started: schema = Dict(
"query" => "Query"
,"Query"=> Dict(
"persona"=>Dict("tipo"=>"Persona")
,"neomatrix"=>Dict("tipo"=>"Persona")
)
,"Persona" => Dict(
"edad"=>Dict("tipo"=>"Int")
,"nombre"=>Dict("tipo"=>"String")
)
)
resolvers=Dict(
"Query"=>Dict(
"neomatrix" => (root,args,ctx,info)->(return Dict("nombre"=>"josue","edad"=>26))
,"persona" => (root,args,ctx,info)->(return Dict("nombre"=>"Diana","edad"=>25))
)
,"Persona"=>Dict(
"edad" => (root,args,ctx,info)->(return root["edad"])
)
)
my_schema = Schema(schema, resolvers) Then Querying query= """
{
neomatrix{
nombre
}
}
"""
result = my_schema.execute(query)
# "{\"data\":{\"neomatrix\":{\"nombre\":\"josue\"}}}" TODO
DocumentationDocumentation and links to additional resources are available at https://neomatrixcode.gitbook.io/diana/ |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论