下拉刷新
Repository Details
Shared bynavbar_avatar
repo_avatar
HelloGitHub Rating
0 ratings
Facebook GraphQL 协议的 Go 语言版本
FreeMIT
Claim
Collect
Share
1.6k
Stars
No
Chinese
JavaScript
Language
No
Active
1
Contributors
131
Issues
Yes
Organization
None
Latest
114
Forks
MIT
License
More
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) } ```
Included in:
Vol.31

Comments

Rating:
No comments yet