go-web based on GIN + Ent + Graph + WIRE (DI).
English | 中文
- Provides rich
Gin
middlewares (CORS) - Simplifies the interaction between the application and database with
ENT
, and automatically generates model code. - Supports multiple query languages, scalability, and multiple APIs with
GRAPH
. - Use
Wire
to resolve dependencies between modules - Uses
Migrate
for database version control
go get -u github.com/google/wire/cmd/wire
- wire -- Compile-time Dependency Injection for Go
- Gin -- The fastest full-featured web framework for Go.
- Wire -- Compile-time Dependency Injection for Go.
- Graph -- A query language and runtime for APIs that simplifies data retrieval and manipulation.
- Ent -- A framework for building scalable and maintainable software with Go.
$ git clone https://github.com/sy-vendor/go-web
$ cd go-web
$ go run cmd/apiserver/main.go
wire ./cmd/apiserver
ent init User
go generate ./ent
type User {
id: ID!
name: String!
sex: Boolean!
age: Int!
Account: String!
Password: String!
}
extend type Query {
"find user by account"
userByAccount(account: String!): User!
}
extend type Mutation {
"update user account password"
updatePasswordByAccount(account: String!, password: String!): User!
}
go run github.com/99designs/gqlgen generate
go run ./cmd/apiserver/main.go
https://studio.apollographql.com/
https://studio.apollographql.com/sandbox/explorer