精简后的项目:仅保留 api/ui 源码、文档、构建依赖
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package resolvers
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
//go:generate go tool github.com/99designs/gqlgen
|
||||
|
||||
type Resolver struct {
|
||||
database *gorm.DB
|
||||
}
|
||||
|
||||
func NewRootResolver(db *gorm.DB) Resolver {
|
||||
return Resolver{
|
||||
database: db,
|
||||
}
|
||||
}
|
||||
|
||||
// DB returns a database instance that is tied to the given context
|
||||
func (r *Resolver) DB(ctx context.Context) *gorm.DB {
|
||||
return r.database.WithContext(ctx)
|
||||
}
|
||||
Reference in New Issue
Block a user