下拉刷新
项目详情
navbar_avatar分享
repo_avatar
HelloGitHub 评分
0 人评分
Facebook GraphQL 协议的 Go 语言版本
开源MIT
认领
收藏
分享
1.6k
星数
中文
JavaScript
主语言
活跃
1
贡献者
131
Issues
组织
最新版本
114
Forks
MIT
协议
更多
Facebook GraphQL 协议的 Go 语言版本。相比之前的其它 GraphQL 库,通过反射结构体的 tag 可以自动生成 schema 给前端,更加便于开发。示例代码: ```go // Friend is a small struct representing a person. type Friend struct { FirstName string Last string `graphql:"lastName"` // use a custom name Added time.Date `graphql:"-"` // don't expose over graphql } // FullName builds a friend's full name. func (f *Friend) FullName() string { return fmt.Sprintf("%s %s", f.FirstName, f.Last) } // registerFriend registers custom resolvers on the Friend type. // // Note: registerFriend wouldn't be necessary if the type only // had the default struct field resolvers above. func registerFriend(schema *schemabuilder.Schema) { object := schema.Object("Friend", Friend{}) // fullName is a computed field on the Friend{} object. object.FieldFunc("fullName", Friend.FullName) } ```
收录于:
第 31 期

评论

评分:
暂无精选评论