作者 yangfu

graphql 自定义模型使用

@@ -4,7 +4,7 @@ go 1.15 @@ -4,7 +4,7 @@ go 1.15
4 4
5 require ( 5 require (
6 github.com/99designs/gqlgen v0.13.0 6 github.com/99designs/gqlgen v0.13.0
7 - github.com/Laisky/laisky-blog-graphql v0.5.1 // indirect 7 + github.com/Laisky/laisky-blog-graphql v0.5.1
8 github.com/ajg/form v1.5.1 // indirect 8 github.com/ajg/form v1.5.1 // indirect
9 github.com/astaxie/beego v1.12.3 9 github.com/astaxie/beego v1.12.3
10 github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect 10 github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect
@@ -12,7 +12,7 @@ type GetClientVersionQuery struct { @@ -12,7 +12,7 @@ type GetClientVersionQuery struct {
12 } 12 }
13 13
14 func (getClientVersionQuery *GetClientVersionQuery) Valid(validation *validation.Validation) { 14 func (getClientVersionQuery *GetClientVersionQuery) Valid(validation *validation.Validation) {
15 - validation.SetError("CustomValid", "未实现的自定义认证") 15 + //validation.SetError("CustomValid", "未实现的自定义认证")
16 } 16 }
17 17
18 func (getClientVersionQuery *GetClientVersionQuery) ValidateQuery() error { 18 func (getClientVersionQuery *GetClientVersionQuery) ValidateQuery() error {
@@ -9,3 +9,7 @@ import ( @@ -9,3 +9,7 @@ import (
9 func CreateTransactionContext(options map[string]interface{}) (application.TransactionContext, error) { 9 func CreateTransactionContext(options map[string]interface{}) (application.TransactionContext, error) {
10 return pG.NewPGTransactionContext(pg.DB), nil 10 return pG.NewPGTransactionContext(pg.DB), nil
11 } 11 }
  12 +
  13 +func CreateDefaultTransactionContext(options map[string]interface{}) (application.TransactionContext, error) {
  14 + return pG.NewPGTransactionContext(pg.DB), nil
  15 +}
1 package models 1 package models
2 2
3 type Access struct { 3 type Access struct {
4 - TableName string `pg:"access,alias:access"` 4 + tableName struct{} `pg:"access,alias:access"`
5 // dcc 5 // dcc
6 Id int64 6 Id int64
7 // 父级Id 7 // 父级Id
@@ -20,7 +20,7 @@ type ClientVersion struct { @@ -20,7 +20,7 @@ type ClientVersion struct {
20 // 其他备注信息 20 // 其他备注信息
21 Remark string 21 Remark string
22 // 客户端安装包信息 22 // 客户端安装包信息
23 - ClientPackageInfo []*domain.ClientPackageInfo `pg:",array"` 23 + ClientPackageInfo []*domain.ClientPackageInfo
24 // 创建时间 24 // 创建时间
25 CreateTime time.Time 25 CreateTime time.Time
26 } 26 }
@@ -49,7 +49,7 @@ func (repository *AccessRepository) Remove(access *domain.Access) (*domain.Acces @@ -49,7 +49,7 @@ func (repository *AccessRepository) Remove(access *domain.Access) (*domain.Acces
49 return access, nil 49 return access, nil
50 } 50 }
51 func (repository *AccessRepository) FindOne(queryOptions map[string]interface{}) (*domain.Access, error) { 51 func (repository *AccessRepository) FindOne(queryOptions map[string]interface{}) (*domain.Access, error) {
52 - tx := repository.transactionContext.PgTx 52 + tx := repository.transactionContext.PgDd
53 accessModel := new(models.Access) 53 accessModel := new(models.Access)
54 query := tx.Model(accessModel) 54 query := tx.Model(accessModel)
55 if accessId, ok := queryOptions["id"]; ok { 55 if accessId, ok := queryOptions["id"]; ok {
@@ -69,7 +69,7 @@ func (repository *AccessRepository) FindOne(queryOptions map[string]interface{}) @@ -69,7 +69,7 @@ func (repository *AccessRepository) FindOne(queryOptions map[string]interface{})
69 } 69 }
70 } 70 }
71 func (repository *AccessRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.Access, error) { 71 func (repository *AccessRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.Access, error) {
72 - tx := repository.transactionContext.PgTx 72 + tx := repository.transactionContext.PgDd
73 var accessModels []*models.Access 73 var accessModels []*models.Access
74 accesss := make([]*domain.Access, 0) 74 accesss := make([]*domain.Access, 0)
75 query := tx.Model(&accessModels) 75 query := tx.Model(&accessModels)
@@ -49,7 +49,7 @@ func (repository *RoleAccessRepository) Remove(roleAccess *domain.RoleAccess) (* @@ -49,7 +49,7 @@ func (repository *RoleAccessRepository) Remove(roleAccess *domain.RoleAccess) (*
49 return roleAccess, nil 49 return roleAccess, nil
50 } 50 }
51 func (repository *RoleAccessRepository) FindOne(queryOptions map[string]interface{}) (*domain.RoleAccess, error) { 51 func (repository *RoleAccessRepository) FindOne(queryOptions map[string]interface{}) (*domain.RoleAccess, error) {
52 - tx := repository.transactionContext.PgTx 52 + tx := repository.transactionContext.PgDd
53 roleAccessModel := new(models.RoleAccess) 53 roleAccessModel := new(models.RoleAccess)
54 query := tx.Model(roleAccessModel) 54 query := tx.Model(roleAccessModel)
55 if roleAccessId, ok := queryOptions["id"]; ok { 55 if roleAccessId, ok := queryOptions["id"]; ok {
@@ -69,7 +69,7 @@ func (repository *RoleAccessRepository) FindOne(queryOptions map[string]interfac @@ -69,7 +69,7 @@ func (repository *RoleAccessRepository) FindOne(queryOptions map[string]interfac
69 } 69 }
70 } 70 }
71 func (repository *RoleAccessRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.RoleAccess, error) { 71 func (repository *RoleAccessRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.RoleAccess, error) {
72 - tx := repository.transactionContext.PgTx 72 + tx := repository.transactionContext.PgDd
73 var roleAccessModels []*models.RoleAccess 73 var roleAccessModels []*models.RoleAccess
74 roleAccesss := make([]*domain.RoleAccess, 0) 74 roleAccesss := make([]*domain.RoleAccess, 0)
75 query := tx.Model(&roleAccessModels) 75 query := tx.Model(&roleAccessModels)
1 # Where are all the schema files located? globs are supported eg src/**/*.graphqls 1 # Where are all the schema files located? globs are supported eg src/**/*.graphqls
2 schema: 2 schema:
3 - graph/*.graphqls 3 - graph/*.graphqls
  4 + - graph/access/*.graphqls
4 5
5 # Where should the generated server code go? 6 # Where should the generated server code go?
6 exec: 7 exec:
@@ -22,6 +23,9 @@ resolver: @@ -22,6 +23,9 @@ resolver:
22 layout: follow-schema 23 layout: follow-schema
23 dir: graph 24 dir: graph
24 package: graph 25 package: graph
  26 +#resolver:
  27 +# filename: resolver.go
  28 +# type: Resolver
25 29
26 # Optional: turn on use `gqlgen:"fieldName"` tags in your models 30 # Optional: turn on use `gqlgen:"fieldName"` tags in your models
27 # struct_tag: json 31 # struct_tag: json
@@ -55,4 +59,8 @@ models: @@ -55,4 +59,8 @@ models:
55 - github.com/99designs/gqlgen/graphql.Int64 59 - github.com/99designs/gqlgen/graphql.Int64
56 - github.com/99designs/gqlgen/graphql.Int32 60 - github.com/99designs/gqlgen/graphql.Int32
57 Date: 61 Date:
58 - model: github.com/Laisky/laisky-blog-graphql/types.Datetime  
  62 + model: github.com/tiptok/godevp/pkg/port/graphql/graph/libs.Datetime
  63 + ClientVersion:
  64 + model: github.com/tiptok/godevp/pkg/domain.ClientVersion
  65 + ClientPackageInfo:
  66 + model: github.com/tiptok/godevp/pkg/domain.ClientPackageInfo
  1 +package graph
  2 +
  3 +// This file will be automatically regenerated based on the schema, any resolver implementations
  4 +// will be copied through when generating and any unknown code will be moved to the end.
  5 +
  6 +import (
  7 + "context"
  8 + "fmt"
  9 +
  10 + "github.com/tiptok/godevp/pkg/port/graphql/graph/generated"
  11 + "github.com/tiptok/godevp/pkg/port/graphql/graph/model"
  12 +)
  13 +
  14 +func (r *accessResolver) User(ctx context.Context, obj *model.Access) (*model.Users, error) {
  15 + panic(fmt.Errorf("not implemented"))
  16 +}
  17 +
  18 +func (r *mutationResolver) CreateMenu(ctx context.Context, input *model.MenuAccessInput) ([]*model.Access, error) {
  19 + panic(fmt.Errorf("not implemented"))
  20 +}
  21 +
  22 +func (r *queryResolver) Menu(ctx context.Context, input *model.MenuAccessInput) ([]*model.Access, error) {
  23 + panic(fmt.Errorf("not implemented"))
  24 +}
  25 +
  26 +// Access returns generated.AccessResolver implementation.
  27 +func (r *Resolver) Access() generated.AccessResolver { return &accessResolver{r} }
  28 +
  29 +type accessResolver struct{ *Resolver }
  1 +## type
  2 +type Access{
  3 + id: Int
  4 + parentId: Int
  5 + accessName: String
  6 + accessCode: String
  7 + accessType: String
  8 + sort: Int
  9 + object: String
  10 + action: String
  11 + module: String
  12 + icon: String
  13 + status: Int
  14 + user: Users
  15 +}
  16 +
  17 +## input
  18 +input menuAccessInput{
  19 + name: String
  20 +}
  21 +extend type Query {
  22 + menu(input: menuAccessInput): [Access!]
  23 +}
  24 +extend type Mutation {
  25 + createMenu(input: menuAccessInput): [Access!]
  26 +}
@@ -12,6 +12,8 @@ import ( @@ -12,6 +12,8 @@ import (
12 12
13 "github.com/99designs/gqlgen/graphql" 13 "github.com/99designs/gqlgen/graphql"
14 "github.com/99designs/gqlgen/graphql/introspection" 14 "github.com/99designs/gqlgen/graphql/introspection"
  15 + "github.com/tiptok/godevp/pkg/domain"
  16 + "github.com/tiptok/godevp/pkg/port/graphql/graph/libs"
15 "github.com/tiptok/godevp/pkg/port/graphql/graph/model" 17 "github.com/tiptok/godevp/pkg/port/graphql/graph/model"
16 gqlparser "github.com/vektah/gqlparser/v2" 18 gqlparser "github.com/vektah/gqlparser/v2"
17 "github.com/vektah/gqlparser/v2/ast" 19 "github.com/vektah/gqlparser/v2/ast"
@@ -35,8 +37,11 @@ type Config struct { @@ -35,8 +37,11 @@ type Config struct {
35 } 37 }
36 38
37 type ResolverRoot interface { 39 type ResolverRoot interface {
  40 + Access() AccessResolver
  41 + ClientVersion() ClientVersionResolver
38 Mutation() MutationResolver 42 Mutation() MutationResolver
39 Query() QueryResolver 43 Query() QueryResolver
  44 + Role() RoleResolver
40 Users() UsersResolver 45 Users() UsersResolver
41 } 46 }
42 47
@@ -44,18 +49,54 @@ type DirectiveRoot struct { @@ -44,18 +49,54 @@ type DirectiveRoot struct {
44 } 49 }
45 50
46 type ComplexityRoot struct { 51 type ComplexityRoot struct {
  52 + Access struct {
  53 + AccessCode func(childComplexity int) int
  54 + AccessName func(childComplexity int) int
  55 + AccessType func(childComplexity int) int
  56 + Action func(childComplexity int) int
  57 + ID func(childComplexity int) int
  58 + Icon func(childComplexity int) int
  59 + Module func(childComplexity int) int
  60 + Object func(childComplexity int) int
  61 + ParentID func(childComplexity int) int
  62 + Sort func(childComplexity int) int
  63 + Status func(childComplexity int) int
  64 + User func(childComplexity int) int
  65 + }
  66 +
  67 + ClientPackageInfo struct {
  68 + FileName func(childComplexity int) int
  69 + Path func(childComplexity int) int
  70 + }
  71 +
  72 + ClientVersion struct {
  73 + ClientPackageInfo func(childComplexity int) int
  74 + Commiter func(childComplexity int) int
  75 + CreateTime func(childComplexity int) int
  76 + Id func(childComplexity int) int
  77 + ProjectName func(childComplexity int) int
  78 + Remark func(childComplexity int) int
  79 + Title func(childComplexity int) int
  80 + Version func(childComplexity int) int
  81 + }
  82 +
47 Mutation struct { 83 Mutation struct {
  84 + CreateMenu func(childComplexity int, input *model.MenuAccessInput) int
48 CreateUsers func(childComplexity int, input model.CreateUsersInput) int 85 CreateUsers func(childComplexity int, input model.CreateUsersInput) int
49 RemoveUsers func(childComplexity int, input model.RemoveUsersInput) int 86 RemoveUsers func(childComplexity int, input model.RemoveUsersInput) int
50 UpdateUsers func(childComplexity int, input model.UpdateUsersInput) int 87 UpdateUsers func(childComplexity int, input model.UpdateUsersInput) int
51 } 88 }
52 89
53 Query struct { 90 Query struct {
54 - User func(childComplexity int, input model.GetUsersInput) int  
55 - Users func(childComplexity int, input model.ListUsersInput) int 91 + ClientVersion func(childComplexity int, id *int) int
  92 + Menu func(childComplexity int, input *model.MenuAccessInput) int
  93 + Menus func(childComplexity int, input *model.MenuAccessInput) int
  94 + User func(childComplexity int, input model.GetUsersInput) int
  95 + Users func(childComplexity int, input model.ListUsersInput) int
56 } 96 }
57 97
58 Role struct { 98 Role struct {
  99 + Access func(childComplexity int) int
59 CreateTime func(childComplexity int) int 100 CreateTime func(childComplexity int) int
60 ID func(childComplexity int) int 101 ID func(childComplexity int) int
61 ParentID func(childComplexity int) int 102 ParentID func(childComplexity int) int
@@ -74,14 +115,27 @@ type ComplexityRoot struct { @@ -74,14 +115,27 @@ type ComplexityRoot struct {
74 } 115 }
75 } 116 }
76 117
  118 +type AccessResolver interface {
  119 + User(ctx context.Context, obj *model.Access) (*model.Users, error)
  120 +}
  121 +type ClientVersionResolver interface {
  122 + CreateTime(ctx context.Context, obj *domain.ClientVersion) (*libs.Datetime, error)
  123 +}
77 type MutationResolver interface { 124 type MutationResolver interface {
78 CreateUsers(ctx context.Context, input model.CreateUsersInput) (*model.Users, error) 125 CreateUsers(ctx context.Context, input model.CreateUsersInput) (*model.Users, error)
79 RemoveUsers(ctx context.Context, input model.RemoveUsersInput) (*model.Users, error) 126 RemoveUsers(ctx context.Context, input model.RemoveUsersInput) (*model.Users, error)
80 UpdateUsers(ctx context.Context, input model.UpdateUsersInput) (*model.Users, error) 127 UpdateUsers(ctx context.Context, input model.UpdateUsersInput) (*model.Users, error)
  128 + CreateMenu(ctx context.Context, input *model.MenuAccessInput) ([]*model.Access, error)
81 } 129 }
82 type QueryResolver interface { 130 type QueryResolver interface {
83 User(ctx context.Context, input model.GetUsersInput) (*model.Users, error) 131 User(ctx context.Context, input model.GetUsersInput) (*model.Users, error)
84 Users(ctx context.Context, input model.ListUsersInput) ([]*model.Users, error) 132 Users(ctx context.Context, input model.ListUsersInput) ([]*model.Users, error)
  133 + Menus(ctx context.Context, input *model.MenuAccessInput) ([]*model.Access, error)
  134 + ClientVersion(ctx context.Context, id *int) (*domain.ClientVersion, error)
  135 + Menu(ctx context.Context, input *model.MenuAccessInput) ([]*model.Access, error)
  136 +}
  137 +type RoleResolver interface {
  138 + Access(ctx context.Context, obj *model.Role) ([]*model.Access, error)
85 } 139 }
86 type UsersResolver interface { 140 type UsersResolver interface {
87 Roles(ctx context.Context, obj *model.Users) ([]*model.Role, error) 141 Roles(ctx context.Context, obj *model.Users) ([]*model.Role, error)
@@ -102,6 +156,172 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in @@ -102,6 +156,172 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
102 _ = ec 156 _ = ec
103 switch typeName + "." + field { 157 switch typeName + "." + field {
104 158
  159 + case "Access.accessCode":
  160 + if e.complexity.Access.AccessCode == nil {
  161 + break
  162 + }
  163 +
  164 + return e.complexity.Access.AccessCode(childComplexity), true
  165 +
  166 + case "Access.accessName":
  167 + if e.complexity.Access.AccessName == nil {
  168 + break
  169 + }
  170 +
  171 + return e.complexity.Access.AccessName(childComplexity), true
  172 +
  173 + case "Access.accessType":
  174 + if e.complexity.Access.AccessType == nil {
  175 + break
  176 + }
  177 +
  178 + return e.complexity.Access.AccessType(childComplexity), true
  179 +
  180 + case "Access.action":
  181 + if e.complexity.Access.Action == nil {
  182 + break
  183 + }
  184 +
  185 + return e.complexity.Access.Action(childComplexity), true
  186 +
  187 + case "Access.id":
  188 + if e.complexity.Access.ID == nil {
  189 + break
  190 + }
  191 +
  192 + return e.complexity.Access.ID(childComplexity), true
  193 +
  194 + case "Access.icon":
  195 + if e.complexity.Access.Icon == nil {
  196 + break
  197 + }
  198 +
  199 + return e.complexity.Access.Icon(childComplexity), true
  200 +
  201 + case "Access.module":
  202 + if e.complexity.Access.Module == nil {
  203 + break
  204 + }
  205 +
  206 + return e.complexity.Access.Module(childComplexity), true
  207 +
  208 + case "Access.object":
  209 + if e.complexity.Access.Object == nil {
  210 + break
  211 + }
  212 +
  213 + return e.complexity.Access.Object(childComplexity), true
  214 +
  215 + case "Access.parentId":
  216 + if e.complexity.Access.ParentID == nil {
  217 + break
  218 + }
  219 +
  220 + return e.complexity.Access.ParentID(childComplexity), true
  221 +
  222 + case "Access.sort":
  223 + if e.complexity.Access.Sort == nil {
  224 + break
  225 + }
  226 +
  227 + return e.complexity.Access.Sort(childComplexity), true
  228 +
  229 + case "Access.status":
  230 + if e.complexity.Access.Status == nil {
  231 + break
  232 + }
  233 +
  234 + return e.complexity.Access.Status(childComplexity), true
  235 +
  236 + case "Access.user":
  237 + if e.complexity.Access.User == nil {
  238 + break
  239 + }
  240 +
  241 + return e.complexity.Access.User(childComplexity), true
  242 +
  243 + case "ClientPackageInfo.FileName":
  244 + if e.complexity.ClientPackageInfo.FileName == nil {
  245 + break
  246 + }
  247 +
  248 + return e.complexity.ClientPackageInfo.FileName(childComplexity), true
  249 +
  250 + case "ClientPackageInfo.Path":
  251 + if e.complexity.ClientPackageInfo.Path == nil {
  252 + break
  253 + }
  254 +
  255 + return e.complexity.ClientPackageInfo.Path(childComplexity), true
  256 +
  257 + case "ClientVersion.clientPackageInfo":
  258 + if e.complexity.ClientVersion.ClientPackageInfo == nil {
  259 + break
  260 + }
  261 +
  262 + return e.complexity.ClientVersion.ClientPackageInfo(childComplexity), true
  263 +
  264 + case "ClientVersion.commiter":
  265 + if e.complexity.ClientVersion.Commiter == nil {
  266 + break
  267 + }
  268 +
  269 + return e.complexity.ClientVersion.Commiter(childComplexity), true
  270 +
  271 + case "ClientVersion.createTime":
  272 + if e.complexity.ClientVersion.CreateTime == nil {
  273 + break
  274 + }
  275 +
  276 + return e.complexity.ClientVersion.CreateTime(childComplexity), true
  277 +
  278 + case "ClientVersion.id":
  279 + if e.complexity.ClientVersion.Id == nil {
  280 + break
  281 + }
  282 +
  283 + return e.complexity.ClientVersion.Id(childComplexity), true
  284 +
  285 + case "ClientVersion.projectName":
  286 + if e.complexity.ClientVersion.ProjectName == nil {
  287 + break
  288 + }
  289 +
  290 + return e.complexity.ClientVersion.ProjectName(childComplexity), true
  291 +
  292 + case "ClientVersion.remark":
  293 + if e.complexity.ClientVersion.Remark == nil {
  294 + break
  295 + }
  296 +
  297 + return e.complexity.ClientVersion.Remark(childComplexity), true
  298 +
  299 + case "ClientVersion.title":
  300 + if e.complexity.ClientVersion.Title == nil {
  301 + break
  302 + }
  303 +
  304 + return e.complexity.ClientVersion.Title(childComplexity), true
  305 +
  306 + case "ClientVersion.version":
  307 + if e.complexity.ClientVersion.Version == nil {
  308 + break
  309 + }
  310 +
  311 + return e.complexity.ClientVersion.Version(childComplexity), true
  312 +
  313 + case "Mutation.createMenu":
  314 + if e.complexity.Mutation.CreateMenu == nil {
  315 + break
  316 + }
  317 +
  318 + args, err := ec.field_Mutation_createMenu_args(context.TODO(), rawArgs)
  319 + if err != nil {
  320 + return 0, false
  321 + }
  322 +
  323 + return e.complexity.Mutation.CreateMenu(childComplexity, args["input"].(*model.MenuAccessInput)), true
  324 +
105 case "Mutation.createUsers": 325 case "Mutation.createUsers":
106 if e.complexity.Mutation.CreateUsers == nil { 326 if e.complexity.Mutation.CreateUsers == nil {
107 break 327 break
@@ -138,6 +358,42 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in @@ -138,6 +358,42 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
138 358
139 return e.complexity.Mutation.UpdateUsers(childComplexity, args["input"].(model.UpdateUsersInput)), true 359 return e.complexity.Mutation.UpdateUsers(childComplexity, args["input"].(model.UpdateUsersInput)), true
140 360
  361 + case "Query.clientVersion":
  362 + if e.complexity.Query.ClientVersion == nil {
  363 + break
  364 + }
  365 +
  366 + args, err := ec.field_Query_clientVersion_args(context.TODO(), rawArgs)
  367 + if err != nil {
  368 + return 0, false
  369 + }
  370 +
  371 + return e.complexity.Query.ClientVersion(childComplexity, args["id"].(*int)), true
  372 +
  373 + case "Query.menu":
  374 + if e.complexity.Query.Menu == nil {
  375 + break
  376 + }
  377 +
  378 + args, err := ec.field_Query_menu_args(context.TODO(), rawArgs)
  379 + if err != nil {
  380 + return 0, false
  381 + }
  382 +
  383 + return e.complexity.Query.Menu(childComplexity, args["input"].(*model.MenuAccessInput)), true
  384 +
  385 + case "Query.menus":
  386 + if e.complexity.Query.Menus == nil {
  387 + break
  388 + }
  389 +
  390 + args, err := ec.field_Query_menus_args(context.TODO(), rawArgs)
  391 + if err != nil {
  392 + return 0, false
  393 + }
  394 +
  395 + return e.complexity.Query.Menus(childComplexity, args["input"].(*model.MenuAccessInput)), true
  396 +
141 case "Query.user": 397 case "Query.user":
142 if e.complexity.Query.User == nil { 398 if e.complexity.Query.User == nil {
143 break 399 break
@@ -162,6 +418,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in @@ -162,6 +418,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
162 418
163 return e.complexity.Query.Users(childComplexity, args["input"].(model.ListUsersInput)), true 419 return e.complexity.Query.Users(childComplexity, args["input"].(model.ListUsersInput)), true
164 420
  421 + case "Role.access":
  422 + if e.complexity.Role.Access == nil {
  423 + break
  424 + }
  425 +
  426 + return e.complexity.Role.Access(childComplexity), true
  427 +
165 case "Role.createTime": 428 case "Role.createTime":
166 if e.complexity.Role.CreateTime == nil { 429 if e.complexity.Role.CreateTime == nil {
167 break 430 break
@@ -310,7 +573,9 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er @@ -310,7 +573,9 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er
310 } 573 }
311 574
312 var sources = []*ast.Source{ 575 var sources = []*ast.Source{
313 - {Name: "graph/schema.graphqls", Input: `## type 576 + {Name: "graph/schema.graphqls", Input: `scalar Date
  577 +
  578 +## type
314 type Users{ 579 type Users{
315 name: String 580 name: String
316 phone: String 581 phone: String
@@ -326,6 +591,22 @@ type Role{ @@ -326,6 +591,22 @@ type Role{
326 parentId: Int 591 parentId: Int
327 createTime: String 592 createTime: String
328 updateTime: String 593 updateTime: String
  594 + access:[Access!]
  595 +}
  596 +type ClientVersion{
  597 + id: Int
  598 + commiter: String
  599 + projectName: String
  600 + version: String
  601 + title: String
  602 + remark: String
  603 + clientPackageInfo: [ClientPackageInfo!]
  604 + createTime: Date
  605 +}
  606 +
  607 +type ClientPackageInfo{
  608 + FileName: String
  609 + Path: String
329 } 610 }
330 611
331 ## user input 612 ## user input
@@ -351,6 +632,10 @@ input listUsersInput{ @@ -351,6 +632,10 @@ input listUsersInput{
351 type Query { 632 type Query {
352 user(input : getUsersInput!): Users! 633 user(input : getUsersInput!): Users!
353 users(input : listUsersInput!): [Users!] 634 users(input : listUsersInput!): [Users!]
  635 +
  636 + menus(input: menuAccessInput): [Access!]
  637 +
  638 + clientVersion(id :Int):ClientVersion!
354 } 639 }
355 640
356 type Mutation{ 641 type Mutation{
@@ -358,6 +643,32 @@ type Mutation{ @@ -358,6 +643,32 @@ type Mutation{
358 removeUsers(input : removeUsersInput!): Users! 643 removeUsers(input : removeUsersInput!): Users!
359 updateUsers(input : updateUsersInput!): Users! 644 updateUsers(input : updateUsersInput!): Users!
360 }`, BuiltIn: false}, 645 }`, BuiltIn: false},
  646 + {Name: "graph/access/access.graphqls", Input: `## type
  647 +type Access{
  648 + id: Int
  649 + parentId: Int
  650 + accessName: String
  651 + accessCode: String
  652 + accessType: String
  653 + sort: Int
  654 + object: String
  655 + action: String
  656 + module: String
  657 + icon: String
  658 + status: Int
  659 + user: Users
  660 +}
  661 +
  662 +## input
  663 +input menuAccessInput{
  664 + name: String
  665 +}
  666 +extend type Query {
  667 + menu(input: menuAccessInput): [Access!]
  668 +}
  669 +extend type Mutation {
  670 + createMenu(input: menuAccessInput): [Access!]
  671 +}`, BuiltIn: false},
361 } 672 }
362 var parsedSchema = gqlparser.MustLoadSchema(sources...) 673 var parsedSchema = gqlparser.MustLoadSchema(sources...)
363 674
@@ -365,6 +676,21 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) @@ -365,6 +676,21 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...)
365 676
366 // region ***************************** args.gotpl ***************************** 677 // region ***************************** args.gotpl *****************************
367 678
  679 +func (ec *executionContext) field_Mutation_createMenu_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
  680 + var err error
  681 + args := map[string]interface{}{}
  682 + var arg0 *model.MenuAccessInput
  683 + if tmp, ok := rawArgs["input"]; ok {
  684 + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input"))
  685 + arg0, err = ec.unmarshalOmenuAccessInput2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐMenuAccessInput(ctx, tmp)
  686 + if err != nil {
  687 + return nil, err
  688 + }
  689 + }
  690 + args["input"] = arg0
  691 + return args, nil
  692 +}
  693 +
368 func (ec *executionContext) field_Mutation_createUsers_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 694 func (ec *executionContext) field_Mutation_createUsers_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
369 var err error 695 var err error
370 args := map[string]interface{}{} 696 args := map[string]interface{}{}
@@ -425,6 +751,51 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs @@ -425,6 +751,51 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs
425 return args, nil 751 return args, nil
426 } 752 }
427 753
  754 +func (ec *executionContext) field_Query_clientVersion_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
  755 + var err error
  756 + args := map[string]interface{}{}
  757 + var arg0 *int
  758 + if tmp, ok := rawArgs["id"]; ok {
  759 + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
  760 + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
  761 + if err != nil {
  762 + return nil, err
  763 + }
  764 + }
  765 + args["id"] = arg0
  766 + return args, nil
  767 +}
  768 +
  769 +func (ec *executionContext) field_Query_menu_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
  770 + var err error
  771 + args := map[string]interface{}{}
  772 + var arg0 *model.MenuAccessInput
  773 + if tmp, ok := rawArgs["input"]; ok {
  774 + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input"))
  775 + arg0, err = ec.unmarshalOmenuAccessInput2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐMenuAccessInput(ctx, tmp)
  776 + if err != nil {
  777 + return nil, err
  778 + }
  779 + }
  780 + args["input"] = arg0
  781 + return args, nil
  782 +}
  783 +
  784 +func (ec *executionContext) field_Query_menus_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
  785 + var err error
  786 + args := map[string]interface{}{}
  787 + var arg0 *model.MenuAccessInput
  788 + if tmp, ok := rawArgs["input"]; ok {
  789 + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input"))
  790 + arg0, err = ec.unmarshalOmenuAccessInput2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐMenuAccessInput(ctx, tmp)
  791 + if err != nil {
  792 + return nil, err
  793 + }
  794 + }
  795 + args["input"] = arg0
  796 + return args, nil
  797 +}
  798 +
428 func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { 799 func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
429 var err error 800 var err error
430 args := map[string]interface{}{} 801 args := map[string]interface{}{}
@@ -455,43 +826,747 @@ func (ec *executionContext) field_Query_users_args(ctx context.Context, rawArgs @@ -455,43 +826,747 @@ func (ec *executionContext) field_Query_users_args(ctx context.Context, rawArgs
455 return args, nil 826 return args, nil
456 } 827 }
457 828
458 -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {  
459 - var err error  
460 - args := map[string]interface{}{}  
461 - var arg0 bool  
462 - if tmp, ok := rawArgs["includeDeprecated"]; ok {  
463 - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated"))  
464 - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp)  
465 - if err != nil {  
466 - return nil, err 829 +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
  830 + var err error
  831 + args := map[string]interface{}{}
  832 + var arg0 bool
  833 + if tmp, ok := rawArgs["includeDeprecated"]; ok {
  834 + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated"))
  835 + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp)
  836 + if err != nil {
  837 + return nil, err
  838 + }
  839 + }
  840 + args["includeDeprecated"] = arg0
  841 + return args, nil
  842 +}
  843 +
  844 +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
  845 + var err error
  846 + args := map[string]interface{}{}
  847 + var arg0 bool
  848 + if tmp, ok := rawArgs["includeDeprecated"]; ok {
  849 + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated"))
  850 + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp)
  851 + if err != nil {
  852 + return nil, err
  853 + }
  854 + }
  855 + args["includeDeprecated"] = arg0
  856 + return args, nil
  857 +}
  858 +
  859 +// endregion ***************************** args.gotpl *****************************
  860 +
  861 +// region ************************** directives.gotpl **************************
  862 +
  863 +// endregion ************************** directives.gotpl **************************
  864 +
  865 +// region **************************** field.gotpl *****************************
  866 +
  867 +func (ec *executionContext) _Access_id(ctx context.Context, field graphql.CollectedField, obj *model.Access) (ret graphql.Marshaler) {
  868 + defer func() {
  869 + if r := recover(); r != nil {
  870 + ec.Error(ctx, ec.Recover(ctx, r))
  871 + ret = graphql.Null
  872 + }
  873 + }()
  874 + fc := &graphql.FieldContext{
  875 + Object: "Access",
  876 + Field: field,
  877 + Args: nil,
  878 + IsMethod: false,
  879 + IsResolver: false,
  880 + }
  881 +
  882 + ctx = graphql.WithFieldContext(ctx, fc)
  883 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  884 + ctx = rctx // use context from middleware stack in children
  885 + return obj.ID, nil
  886 + })
  887 + if err != nil {
  888 + ec.Error(ctx, err)
  889 + return graphql.Null
  890 + }
  891 + if resTmp == nil {
  892 + return graphql.Null
  893 + }
  894 + res := resTmp.(*int)
  895 + fc.Result = res
  896 + return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
  897 +}
  898 +
  899 +func (ec *executionContext) _Access_parentId(ctx context.Context, field graphql.CollectedField, obj *model.Access) (ret graphql.Marshaler) {
  900 + defer func() {
  901 + if r := recover(); r != nil {
  902 + ec.Error(ctx, ec.Recover(ctx, r))
  903 + ret = graphql.Null
  904 + }
  905 + }()
  906 + fc := &graphql.FieldContext{
  907 + Object: "Access",
  908 + Field: field,
  909 + Args: nil,
  910 + IsMethod: false,
  911 + IsResolver: false,
  912 + }
  913 +
  914 + ctx = graphql.WithFieldContext(ctx, fc)
  915 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  916 + ctx = rctx // use context from middleware stack in children
  917 + return obj.ParentID, nil
  918 + })
  919 + if err != nil {
  920 + ec.Error(ctx, err)
  921 + return graphql.Null
  922 + }
  923 + if resTmp == nil {
  924 + return graphql.Null
  925 + }
  926 + res := resTmp.(*int)
  927 + fc.Result = res
  928 + return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
  929 +}
  930 +
  931 +func (ec *executionContext) _Access_accessName(ctx context.Context, field graphql.CollectedField, obj *model.Access) (ret graphql.Marshaler) {
  932 + defer func() {
  933 + if r := recover(); r != nil {
  934 + ec.Error(ctx, ec.Recover(ctx, r))
  935 + ret = graphql.Null
  936 + }
  937 + }()
  938 + fc := &graphql.FieldContext{
  939 + Object: "Access",
  940 + Field: field,
  941 + Args: nil,
  942 + IsMethod: false,
  943 + IsResolver: false,
  944 + }
  945 +
  946 + ctx = graphql.WithFieldContext(ctx, fc)
  947 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  948 + ctx = rctx // use context from middleware stack in children
  949 + return obj.AccessName, nil
  950 + })
  951 + if err != nil {
  952 + ec.Error(ctx, err)
  953 + return graphql.Null
  954 + }
  955 + if resTmp == nil {
  956 + return graphql.Null
  957 + }
  958 + res := resTmp.(*string)
  959 + fc.Result = res
  960 + return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
  961 +}
  962 +
  963 +func (ec *executionContext) _Access_accessCode(ctx context.Context, field graphql.CollectedField, obj *model.Access) (ret graphql.Marshaler) {
  964 + defer func() {
  965 + if r := recover(); r != nil {
  966 + ec.Error(ctx, ec.Recover(ctx, r))
  967 + ret = graphql.Null
  968 + }
  969 + }()
  970 + fc := &graphql.FieldContext{
  971 + Object: "Access",
  972 + Field: field,
  973 + Args: nil,
  974 + IsMethod: false,
  975 + IsResolver: false,
  976 + }
  977 +
  978 + ctx = graphql.WithFieldContext(ctx, fc)
  979 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  980 + ctx = rctx // use context from middleware stack in children
  981 + return obj.AccessCode, nil
  982 + })
  983 + if err != nil {
  984 + ec.Error(ctx, err)
  985 + return graphql.Null
  986 + }
  987 + if resTmp == nil {
  988 + return graphql.Null
  989 + }
  990 + res := resTmp.(*string)
  991 + fc.Result = res
  992 + return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
  993 +}
  994 +
  995 +func (ec *executionContext) _Access_accessType(ctx context.Context, field graphql.CollectedField, obj *model.Access) (ret graphql.Marshaler) {
  996 + defer func() {
  997 + if r := recover(); r != nil {
  998 + ec.Error(ctx, ec.Recover(ctx, r))
  999 + ret = graphql.Null
  1000 + }
  1001 + }()
  1002 + fc := &graphql.FieldContext{
  1003 + Object: "Access",
  1004 + Field: field,
  1005 + Args: nil,
  1006 + IsMethod: false,
  1007 + IsResolver: false,
  1008 + }
  1009 +
  1010 + ctx = graphql.WithFieldContext(ctx, fc)
  1011 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1012 + ctx = rctx // use context from middleware stack in children
  1013 + return obj.AccessType, nil
  1014 + })
  1015 + if err != nil {
  1016 + ec.Error(ctx, err)
  1017 + return graphql.Null
  1018 + }
  1019 + if resTmp == nil {
  1020 + return graphql.Null
  1021 + }
  1022 + res := resTmp.(*string)
  1023 + fc.Result = res
  1024 + return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
  1025 +}
  1026 +
  1027 +func (ec *executionContext) _Access_sort(ctx context.Context, field graphql.CollectedField, obj *model.Access) (ret graphql.Marshaler) {
  1028 + defer func() {
  1029 + if r := recover(); r != nil {
  1030 + ec.Error(ctx, ec.Recover(ctx, r))
  1031 + ret = graphql.Null
  1032 + }
  1033 + }()
  1034 + fc := &graphql.FieldContext{
  1035 + Object: "Access",
  1036 + Field: field,
  1037 + Args: nil,
  1038 + IsMethod: false,
  1039 + IsResolver: false,
  1040 + }
  1041 +
  1042 + ctx = graphql.WithFieldContext(ctx, fc)
  1043 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1044 + ctx = rctx // use context from middleware stack in children
  1045 + return obj.Sort, nil
  1046 + })
  1047 + if err != nil {
  1048 + ec.Error(ctx, err)
  1049 + return graphql.Null
  1050 + }
  1051 + if resTmp == nil {
  1052 + return graphql.Null
  1053 + }
  1054 + res := resTmp.(*int)
  1055 + fc.Result = res
  1056 + return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
  1057 +}
  1058 +
  1059 +func (ec *executionContext) _Access_object(ctx context.Context, field graphql.CollectedField, obj *model.Access) (ret graphql.Marshaler) {
  1060 + defer func() {
  1061 + if r := recover(); r != nil {
  1062 + ec.Error(ctx, ec.Recover(ctx, r))
  1063 + ret = graphql.Null
  1064 + }
  1065 + }()
  1066 + fc := &graphql.FieldContext{
  1067 + Object: "Access",
  1068 + Field: field,
  1069 + Args: nil,
  1070 + IsMethod: false,
  1071 + IsResolver: false,
  1072 + }
  1073 +
  1074 + ctx = graphql.WithFieldContext(ctx, fc)
  1075 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1076 + ctx = rctx // use context from middleware stack in children
  1077 + return obj.Object, nil
  1078 + })
  1079 + if err != nil {
  1080 + ec.Error(ctx, err)
  1081 + return graphql.Null
  1082 + }
  1083 + if resTmp == nil {
  1084 + return graphql.Null
  1085 + }
  1086 + res := resTmp.(*string)
  1087 + fc.Result = res
  1088 + return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
  1089 +}
  1090 +
  1091 +func (ec *executionContext) _Access_action(ctx context.Context, field graphql.CollectedField, obj *model.Access) (ret graphql.Marshaler) {
  1092 + defer func() {
  1093 + if r := recover(); r != nil {
  1094 + ec.Error(ctx, ec.Recover(ctx, r))
  1095 + ret = graphql.Null
  1096 + }
  1097 + }()
  1098 + fc := &graphql.FieldContext{
  1099 + Object: "Access",
  1100 + Field: field,
  1101 + Args: nil,
  1102 + IsMethod: false,
  1103 + IsResolver: false,
  1104 + }
  1105 +
  1106 + ctx = graphql.WithFieldContext(ctx, fc)
  1107 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1108 + ctx = rctx // use context from middleware stack in children
  1109 + return obj.Action, nil
  1110 + })
  1111 + if err != nil {
  1112 + ec.Error(ctx, err)
  1113 + return graphql.Null
  1114 + }
  1115 + if resTmp == nil {
  1116 + return graphql.Null
  1117 + }
  1118 + res := resTmp.(*string)
  1119 + fc.Result = res
  1120 + return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
  1121 +}
  1122 +
  1123 +func (ec *executionContext) _Access_module(ctx context.Context, field graphql.CollectedField, obj *model.Access) (ret graphql.Marshaler) {
  1124 + defer func() {
  1125 + if r := recover(); r != nil {
  1126 + ec.Error(ctx, ec.Recover(ctx, r))
  1127 + ret = graphql.Null
  1128 + }
  1129 + }()
  1130 + fc := &graphql.FieldContext{
  1131 + Object: "Access",
  1132 + Field: field,
  1133 + Args: nil,
  1134 + IsMethod: false,
  1135 + IsResolver: false,
  1136 + }
  1137 +
  1138 + ctx = graphql.WithFieldContext(ctx, fc)
  1139 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1140 + ctx = rctx // use context from middleware stack in children
  1141 + return obj.Module, nil
  1142 + })
  1143 + if err != nil {
  1144 + ec.Error(ctx, err)
  1145 + return graphql.Null
  1146 + }
  1147 + if resTmp == nil {
  1148 + return graphql.Null
  1149 + }
  1150 + res := resTmp.(*string)
  1151 + fc.Result = res
  1152 + return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
  1153 +}
  1154 +
  1155 +func (ec *executionContext) _Access_icon(ctx context.Context, field graphql.CollectedField, obj *model.Access) (ret graphql.Marshaler) {
  1156 + defer func() {
  1157 + if r := recover(); r != nil {
  1158 + ec.Error(ctx, ec.Recover(ctx, r))
  1159 + ret = graphql.Null
  1160 + }
  1161 + }()
  1162 + fc := &graphql.FieldContext{
  1163 + Object: "Access",
  1164 + Field: field,
  1165 + Args: nil,
  1166 + IsMethod: false,
  1167 + IsResolver: false,
  1168 + }
  1169 +
  1170 + ctx = graphql.WithFieldContext(ctx, fc)
  1171 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1172 + ctx = rctx // use context from middleware stack in children
  1173 + return obj.Icon, nil
  1174 + })
  1175 + if err != nil {
  1176 + ec.Error(ctx, err)
  1177 + return graphql.Null
  1178 + }
  1179 + if resTmp == nil {
  1180 + return graphql.Null
  1181 + }
  1182 + res := resTmp.(*string)
  1183 + fc.Result = res
  1184 + return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
  1185 +}
  1186 +
  1187 +func (ec *executionContext) _Access_status(ctx context.Context, field graphql.CollectedField, obj *model.Access) (ret graphql.Marshaler) {
  1188 + defer func() {
  1189 + if r := recover(); r != nil {
  1190 + ec.Error(ctx, ec.Recover(ctx, r))
  1191 + ret = graphql.Null
  1192 + }
  1193 + }()
  1194 + fc := &graphql.FieldContext{
  1195 + Object: "Access",
  1196 + Field: field,
  1197 + Args: nil,
  1198 + IsMethod: false,
  1199 + IsResolver: false,
  1200 + }
  1201 +
  1202 + ctx = graphql.WithFieldContext(ctx, fc)
  1203 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1204 + ctx = rctx // use context from middleware stack in children
  1205 + return obj.Status, nil
  1206 + })
  1207 + if err != nil {
  1208 + ec.Error(ctx, err)
  1209 + return graphql.Null
  1210 + }
  1211 + if resTmp == nil {
  1212 + return graphql.Null
  1213 + }
  1214 + res := resTmp.(*int)
  1215 + fc.Result = res
  1216 + return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
  1217 +}
  1218 +
  1219 +func (ec *executionContext) _Access_user(ctx context.Context, field graphql.CollectedField, obj *model.Access) (ret graphql.Marshaler) {
  1220 + defer func() {
  1221 + if r := recover(); r != nil {
  1222 + ec.Error(ctx, ec.Recover(ctx, r))
  1223 + ret = graphql.Null
  1224 + }
  1225 + }()
  1226 + fc := &graphql.FieldContext{
  1227 + Object: "Access",
  1228 + Field: field,
  1229 + Args: nil,
  1230 + IsMethod: true,
  1231 + IsResolver: true,
  1232 + }
  1233 +
  1234 + ctx = graphql.WithFieldContext(ctx, fc)
  1235 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1236 + ctx = rctx // use context from middleware stack in children
  1237 + return ec.resolvers.Access().User(rctx, obj)
  1238 + })
  1239 + if err != nil {
  1240 + ec.Error(ctx, err)
  1241 + return graphql.Null
  1242 + }
  1243 + if resTmp == nil {
  1244 + return graphql.Null
  1245 + }
  1246 + res := resTmp.(*model.Users)
  1247 + fc.Result = res
  1248 + return ec.marshalOUsers2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐUsers(ctx, field.Selections, res)
  1249 +}
  1250 +
  1251 +func (ec *executionContext) _ClientPackageInfo_FileName(ctx context.Context, field graphql.CollectedField, obj *domain.ClientPackageInfo) (ret graphql.Marshaler) {
  1252 + defer func() {
  1253 + if r := recover(); r != nil {
  1254 + ec.Error(ctx, ec.Recover(ctx, r))
  1255 + ret = graphql.Null
  1256 + }
  1257 + }()
  1258 + fc := &graphql.FieldContext{
  1259 + Object: "ClientPackageInfo",
  1260 + Field: field,
  1261 + Args: nil,
  1262 + IsMethod: false,
  1263 + IsResolver: false,
  1264 + }
  1265 +
  1266 + ctx = graphql.WithFieldContext(ctx, fc)
  1267 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1268 + ctx = rctx // use context from middleware stack in children
  1269 + return obj.FileName, nil
  1270 + })
  1271 + if err != nil {
  1272 + ec.Error(ctx, err)
  1273 + return graphql.Null
  1274 + }
  1275 + if resTmp == nil {
  1276 + return graphql.Null
  1277 + }
  1278 + res := resTmp.(string)
  1279 + fc.Result = res
  1280 + return ec.marshalOString2string(ctx, field.Selections, res)
  1281 +}
  1282 +
  1283 +func (ec *executionContext) _ClientPackageInfo_Path(ctx context.Context, field graphql.CollectedField, obj *domain.ClientPackageInfo) (ret graphql.Marshaler) {
  1284 + defer func() {
  1285 + if r := recover(); r != nil {
  1286 + ec.Error(ctx, ec.Recover(ctx, r))
  1287 + ret = graphql.Null
  1288 + }
  1289 + }()
  1290 + fc := &graphql.FieldContext{
  1291 + Object: "ClientPackageInfo",
  1292 + Field: field,
  1293 + Args: nil,
  1294 + IsMethod: false,
  1295 + IsResolver: false,
  1296 + }
  1297 +
  1298 + ctx = graphql.WithFieldContext(ctx, fc)
  1299 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1300 + ctx = rctx // use context from middleware stack in children
  1301 + return obj.Path, nil
  1302 + })
  1303 + if err != nil {
  1304 + ec.Error(ctx, err)
  1305 + return graphql.Null
  1306 + }
  1307 + if resTmp == nil {
  1308 + return graphql.Null
  1309 + }
  1310 + res := resTmp.(string)
  1311 + fc.Result = res
  1312 + return ec.marshalOString2string(ctx, field.Selections, res)
  1313 +}
  1314 +
  1315 +func (ec *executionContext) _ClientVersion_id(ctx context.Context, field graphql.CollectedField, obj *domain.ClientVersion) (ret graphql.Marshaler) {
  1316 + defer func() {
  1317 + if r := recover(); r != nil {
  1318 + ec.Error(ctx, ec.Recover(ctx, r))
  1319 + ret = graphql.Null
  1320 + }
  1321 + }()
  1322 + fc := &graphql.FieldContext{
  1323 + Object: "ClientVersion",
  1324 + Field: field,
  1325 + Args: nil,
  1326 + IsMethod: false,
  1327 + IsResolver: false,
  1328 + }
  1329 +
  1330 + ctx = graphql.WithFieldContext(ctx, fc)
  1331 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1332 + ctx = rctx // use context from middleware stack in children
  1333 + return obj.Id, nil
  1334 + })
  1335 + if err != nil {
  1336 + ec.Error(ctx, err)
  1337 + return graphql.Null
  1338 + }
  1339 + if resTmp == nil {
  1340 + return graphql.Null
  1341 + }
  1342 + res := resTmp.(int64)
  1343 + fc.Result = res
  1344 + return ec.marshalOInt2int64(ctx, field.Selections, res)
  1345 +}
  1346 +
  1347 +func (ec *executionContext) _ClientVersion_commiter(ctx context.Context, field graphql.CollectedField, obj *domain.ClientVersion) (ret graphql.Marshaler) {
  1348 + defer func() {
  1349 + if r := recover(); r != nil {
  1350 + ec.Error(ctx, ec.Recover(ctx, r))
  1351 + ret = graphql.Null
  1352 + }
  1353 + }()
  1354 + fc := &graphql.FieldContext{
  1355 + Object: "ClientVersion",
  1356 + Field: field,
  1357 + Args: nil,
  1358 + IsMethod: false,
  1359 + IsResolver: false,
  1360 + }
  1361 +
  1362 + ctx = graphql.WithFieldContext(ctx, fc)
  1363 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1364 + ctx = rctx // use context from middleware stack in children
  1365 + return obj.Commiter, nil
  1366 + })
  1367 + if err != nil {
  1368 + ec.Error(ctx, err)
  1369 + return graphql.Null
  1370 + }
  1371 + if resTmp == nil {
  1372 + return graphql.Null
  1373 + }
  1374 + res := resTmp.(string)
  1375 + fc.Result = res
  1376 + return ec.marshalOString2string(ctx, field.Selections, res)
  1377 +}
  1378 +
  1379 +func (ec *executionContext) _ClientVersion_projectName(ctx context.Context, field graphql.CollectedField, obj *domain.ClientVersion) (ret graphql.Marshaler) {
  1380 + defer func() {
  1381 + if r := recover(); r != nil {
  1382 + ec.Error(ctx, ec.Recover(ctx, r))
  1383 + ret = graphql.Null
  1384 + }
  1385 + }()
  1386 + fc := &graphql.FieldContext{
  1387 + Object: "ClientVersion",
  1388 + Field: field,
  1389 + Args: nil,
  1390 + IsMethod: false,
  1391 + IsResolver: false,
  1392 + }
  1393 +
  1394 + ctx = graphql.WithFieldContext(ctx, fc)
  1395 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1396 + ctx = rctx // use context from middleware stack in children
  1397 + return obj.ProjectName, nil
  1398 + })
  1399 + if err != nil {
  1400 + ec.Error(ctx, err)
  1401 + return graphql.Null
  1402 + }
  1403 + if resTmp == nil {
  1404 + return graphql.Null
  1405 + }
  1406 + res := resTmp.(string)
  1407 + fc.Result = res
  1408 + return ec.marshalOString2string(ctx, field.Selections, res)
  1409 +}
  1410 +
  1411 +func (ec *executionContext) _ClientVersion_version(ctx context.Context, field graphql.CollectedField, obj *domain.ClientVersion) (ret graphql.Marshaler) {
  1412 + defer func() {
  1413 + if r := recover(); r != nil {
  1414 + ec.Error(ctx, ec.Recover(ctx, r))
  1415 + ret = graphql.Null
  1416 + }
  1417 + }()
  1418 + fc := &graphql.FieldContext{
  1419 + Object: "ClientVersion",
  1420 + Field: field,
  1421 + Args: nil,
  1422 + IsMethod: false,
  1423 + IsResolver: false,
  1424 + }
  1425 +
  1426 + ctx = graphql.WithFieldContext(ctx, fc)
  1427 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1428 + ctx = rctx // use context from middleware stack in children
  1429 + return obj.Version, nil
  1430 + })
  1431 + if err != nil {
  1432 + ec.Error(ctx, err)
  1433 + return graphql.Null
  1434 + }
  1435 + if resTmp == nil {
  1436 + return graphql.Null
  1437 + }
  1438 + res := resTmp.(string)
  1439 + fc.Result = res
  1440 + return ec.marshalOString2string(ctx, field.Selections, res)
  1441 +}
  1442 +
  1443 +func (ec *executionContext) _ClientVersion_title(ctx context.Context, field graphql.CollectedField, obj *domain.ClientVersion) (ret graphql.Marshaler) {
  1444 + defer func() {
  1445 + if r := recover(); r != nil {
  1446 + ec.Error(ctx, ec.Recover(ctx, r))
  1447 + ret = graphql.Null
  1448 + }
  1449 + }()
  1450 + fc := &graphql.FieldContext{
  1451 + Object: "ClientVersion",
  1452 + Field: field,
  1453 + Args: nil,
  1454 + IsMethod: false,
  1455 + IsResolver: false,
  1456 + }
  1457 +
  1458 + ctx = graphql.WithFieldContext(ctx, fc)
  1459 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1460 + ctx = rctx // use context from middleware stack in children
  1461 + return obj.Title, nil
  1462 + })
  1463 + if err != nil {
  1464 + ec.Error(ctx, err)
  1465 + return graphql.Null
  1466 + }
  1467 + if resTmp == nil {
  1468 + return graphql.Null
  1469 + }
  1470 + res := resTmp.(string)
  1471 + fc.Result = res
  1472 + return ec.marshalOString2string(ctx, field.Selections, res)
  1473 +}
  1474 +
  1475 +func (ec *executionContext) _ClientVersion_remark(ctx context.Context, field graphql.CollectedField, obj *domain.ClientVersion) (ret graphql.Marshaler) {
  1476 + defer func() {
  1477 + if r := recover(); r != nil {
  1478 + ec.Error(ctx, ec.Recover(ctx, r))
  1479 + ret = graphql.Null
  1480 + }
  1481 + }()
  1482 + fc := &graphql.FieldContext{
  1483 + Object: "ClientVersion",
  1484 + Field: field,
  1485 + Args: nil,
  1486 + IsMethod: false,
  1487 + IsResolver: false,
  1488 + }
  1489 +
  1490 + ctx = graphql.WithFieldContext(ctx, fc)
  1491 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1492 + ctx = rctx // use context from middleware stack in children
  1493 + return obj.Remark, nil
  1494 + })
  1495 + if err != nil {
  1496 + ec.Error(ctx, err)
  1497 + return graphql.Null
  1498 + }
  1499 + if resTmp == nil {
  1500 + return graphql.Null
  1501 + }
  1502 + res := resTmp.(string)
  1503 + fc.Result = res
  1504 + return ec.marshalOString2string(ctx, field.Selections, res)
  1505 +}
  1506 +
  1507 +func (ec *executionContext) _ClientVersion_clientPackageInfo(ctx context.Context, field graphql.CollectedField, obj *domain.ClientVersion) (ret graphql.Marshaler) {
  1508 + defer func() {
  1509 + if r := recover(); r != nil {
  1510 + ec.Error(ctx, ec.Recover(ctx, r))
  1511 + ret = graphql.Null
467 } 1512 }
  1513 + }()
  1514 + fc := &graphql.FieldContext{
  1515 + Object: "ClientVersion",
  1516 + Field: field,
  1517 + Args: nil,
  1518 + IsMethod: false,
  1519 + IsResolver: false,
468 } 1520 }
469 - args["includeDeprecated"] = arg0  
470 - return args, nil  
471 -}  
472 1521
473 -func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {  
474 - var err error  
475 - args := map[string]interface{}{}  
476 - var arg0 bool  
477 - if tmp, ok := rawArgs["includeDeprecated"]; ok {  
478 - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated"))  
479 - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp)  
480 - if err != nil {  
481 - return nil, err  
482 - } 1522 + ctx = graphql.WithFieldContext(ctx, fc)
  1523 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1524 + ctx = rctx // use context from middleware stack in children
  1525 + return obj.ClientPackageInfo, nil
  1526 + })
  1527 + if err != nil {
  1528 + ec.Error(ctx, err)
  1529 + return graphql.Null
483 } 1530 }
484 - args["includeDeprecated"] = arg0  
485 - return args, nil 1531 + if resTmp == nil {
  1532 + return graphql.Null
  1533 + }
  1534 + res := resTmp.([]*domain.ClientPackageInfo)
  1535 + fc.Result = res
  1536 + return ec.marshalOClientPackageInfo2ᚕᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋdomainᚐClientPackageInfoᚄ(ctx, field.Selections, res)
486 } 1537 }
487 1538
488 -// endregion ***************************** args.gotpl *****************************  
489 -  
490 -// region ************************** directives.gotpl **************************  
491 -  
492 -// endregion ************************** directives.gotpl ************************** 1539 +func (ec *executionContext) _ClientVersion_createTime(ctx context.Context, field graphql.CollectedField, obj *domain.ClientVersion) (ret graphql.Marshaler) {
  1540 + defer func() {
  1541 + if r := recover(); r != nil {
  1542 + ec.Error(ctx, ec.Recover(ctx, r))
  1543 + ret = graphql.Null
  1544 + }
  1545 + }()
  1546 + fc := &graphql.FieldContext{
  1547 + Object: "ClientVersion",
  1548 + Field: field,
  1549 + Args: nil,
  1550 + IsMethod: true,
  1551 + IsResolver: true,
  1552 + }
493 1553
494 -// region **************************** field.gotpl ***************************** 1554 + ctx = graphql.WithFieldContext(ctx, fc)
  1555 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1556 + ctx = rctx // use context from middleware stack in children
  1557 + return ec.resolvers.ClientVersion().CreateTime(rctx, obj)
  1558 + })
  1559 + if err != nil {
  1560 + ec.Error(ctx, err)
  1561 + return graphql.Null
  1562 + }
  1563 + if resTmp == nil {
  1564 + return graphql.Null
  1565 + }
  1566 + res := resTmp.(*libs.Datetime)
  1567 + fc.Result = res
  1568 + return ec.marshalODate2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋlibsᚐDatetime(ctx, field.Selections, res)
  1569 +}
495 1570
496 func (ec *executionContext) _Mutation_createUsers(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { 1571 func (ec *executionContext) _Mutation_createUsers(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
497 defer func() { 1572 defer func() {
@@ -619,6 +1694,45 @@ func (ec *executionContext) _Mutation_updateUsers(ctx context.Context, field gra @@ -619,6 +1694,45 @@ func (ec *executionContext) _Mutation_updateUsers(ctx context.Context, field gra
619 return ec.marshalNUsers2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐUsers(ctx, field.Selections, res) 1694 return ec.marshalNUsers2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐUsers(ctx, field.Selections, res)
620 } 1695 }
621 1696
  1697 +func (ec *executionContext) _Mutation_createMenu(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
  1698 + defer func() {
  1699 + if r := recover(); r != nil {
  1700 + ec.Error(ctx, ec.Recover(ctx, r))
  1701 + ret = graphql.Null
  1702 + }
  1703 + }()
  1704 + fc := &graphql.FieldContext{
  1705 + Object: "Mutation",
  1706 + Field: field,
  1707 + Args: nil,
  1708 + IsMethod: true,
  1709 + IsResolver: true,
  1710 + }
  1711 +
  1712 + ctx = graphql.WithFieldContext(ctx, fc)
  1713 + rawArgs := field.ArgumentMap(ec.Variables)
  1714 + args, err := ec.field_Mutation_createMenu_args(ctx, rawArgs)
  1715 + if err != nil {
  1716 + ec.Error(ctx, err)
  1717 + return graphql.Null
  1718 + }
  1719 + fc.Args = args
  1720 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1721 + ctx = rctx // use context from middleware stack in children
  1722 + return ec.resolvers.Mutation().CreateMenu(rctx, args["input"].(*model.MenuAccessInput))
  1723 + })
  1724 + if err != nil {
  1725 + ec.Error(ctx, err)
  1726 + return graphql.Null
  1727 + }
  1728 + if resTmp == nil {
  1729 + return graphql.Null
  1730 + }
  1731 + res := resTmp.([]*model.Access)
  1732 + fc.Result = res
  1733 + return ec.marshalOAccess2ᚕᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐAccessᚄ(ctx, field.Selections, res)
  1734 +}
  1735 +
622 func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { 1736 func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
623 defer func() { 1737 defer func() {
624 if r := recover(); r != nil { 1738 if r := recover(); r != nil {
@@ -700,6 +1814,126 @@ func (ec *executionContext) _Query_users(ctx context.Context, field graphql.Coll @@ -700,6 +1814,126 @@ func (ec *executionContext) _Query_users(ctx context.Context, field graphql.Coll
700 return ec.marshalOUsers2ᚕᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐUsersᚄ(ctx, field.Selections, res) 1814 return ec.marshalOUsers2ᚕᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐUsersᚄ(ctx, field.Selections, res)
701 } 1815 }
702 1816
  1817 +func (ec *executionContext) _Query_menus(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
  1818 + defer func() {
  1819 + if r := recover(); r != nil {
  1820 + ec.Error(ctx, ec.Recover(ctx, r))
  1821 + ret = graphql.Null
  1822 + }
  1823 + }()
  1824 + fc := &graphql.FieldContext{
  1825 + Object: "Query",
  1826 + Field: field,
  1827 + Args: nil,
  1828 + IsMethod: true,
  1829 + IsResolver: true,
  1830 + }
  1831 +
  1832 + ctx = graphql.WithFieldContext(ctx, fc)
  1833 + rawArgs := field.ArgumentMap(ec.Variables)
  1834 + args, err := ec.field_Query_menus_args(ctx, rawArgs)
  1835 + if err != nil {
  1836 + ec.Error(ctx, err)
  1837 + return graphql.Null
  1838 + }
  1839 + fc.Args = args
  1840 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1841 + ctx = rctx // use context from middleware stack in children
  1842 + return ec.resolvers.Query().Menus(rctx, args["input"].(*model.MenuAccessInput))
  1843 + })
  1844 + if err != nil {
  1845 + ec.Error(ctx, err)
  1846 + return graphql.Null
  1847 + }
  1848 + if resTmp == nil {
  1849 + return graphql.Null
  1850 + }
  1851 + res := resTmp.([]*model.Access)
  1852 + fc.Result = res
  1853 + return ec.marshalOAccess2ᚕᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐAccessᚄ(ctx, field.Selections, res)
  1854 +}
  1855 +
  1856 +func (ec *executionContext) _Query_clientVersion(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
  1857 + defer func() {
  1858 + if r := recover(); r != nil {
  1859 + ec.Error(ctx, ec.Recover(ctx, r))
  1860 + ret = graphql.Null
  1861 + }
  1862 + }()
  1863 + fc := &graphql.FieldContext{
  1864 + Object: "Query",
  1865 + Field: field,
  1866 + Args: nil,
  1867 + IsMethod: true,
  1868 + IsResolver: true,
  1869 + }
  1870 +
  1871 + ctx = graphql.WithFieldContext(ctx, fc)
  1872 + rawArgs := field.ArgumentMap(ec.Variables)
  1873 + args, err := ec.field_Query_clientVersion_args(ctx, rawArgs)
  1874 + if err != nil {
  1875 + ec.Error(ctx, err)
  1876 + return graphql.Null
  1877 + }
  1878 + fc.Args = args
  1879 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1880 + ctx = rctx // use context from middleware stack in children
  1881 + return ec.resolvers.Query().ClientVersion(rctx, args["id"].(*int))
  1882 + })
  1883 + if err != nil {
  1884 + ec.Error(ctx, err)
  1885 + return graphql.Null
  1886 + }
  1887 + if resTmp == nil {
  1888 + if !graphql.HasFieldError(ctx, fc) {
  1889 + ec.Errorf(ctx, "must not be null")
  1890 + }
  1891 + return graphql.Null
  1892 + }
  1893 + res := resTmp.(*domain.ClientVersion)
  1894 + fc.Result = res
  1895 + return ec.marshalNClientVersion2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋdomainᚐClientVersion(ctx, field.Selections, res)
  1896 +}
  1897 +
  1898 +func (ec *executionContext) _Query_menu(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
  1899 + defer func() {
  1900 + if r := recover(); r != nil {
  1901 + ec.Error(ctx, ec.Recover(ctx, r))
  1902 + ret = graphql.Null
  1903 + }
  1904 + }()
  1905 + fc := &graphql.FieldContext{
  1906 + Object: "Query",
  1907 + Field: field,
  1908 + Args: nil,
  1909 + IsMethod: true,
  1910 + IsResolver: true,
  1911 + }
  1912 +
  1913 + ctx = graphql.WithFieldContext(ctx, fc)
  1914 + rawArgs := field.ArgumentMap(ec.Variables)
  1915 + args, err := ec.field_Query_menu_args(ctx, rawArgs)
  1916 + if err != nil {
  1917 + ec.Error(ctx, err)
  1918 + return graphql.Null
  1919 + }
  1920 + fc.Args = args
  1921 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  1922 + ctx = rctx // use context from middleware stack in children
  1923 + return ec.resolvers.Query().Menu(rctx, args["input"].(*model.MenuAccessInput))
  1924 + })
  1925 + if err != nil {
  1926 + ec.Error(ctx, err)
  1927 + return graphql.Null
  1928 + }
  1929 + if resTmp == nil {
  1930 + return graphql.Null
  1931 + }
  1932 + res := resTmp.([]*model.Access)
  1933 + fc.Result = res
  1934 + return ec.marshalOAccess2ᚕᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐAccessᚄ(ctx, field.Selections, res)
  1935 +}
  1936 +
703 func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { 1937 func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
704 defer func() { 1938 defer func() {
705 if r := recover(); r != nil { 1939 if r := recover(); r != nil {
@@ -931,6 +2165,38 @@ func (ec *executionContext) _Role_updateTime(ctx context.Context, field graphql. @@ -931,6 +2165,38 @@ func (ec *executionContext) _Role_updateTime(ctx context.Context, field graphql.
931 return ec.marshalOString2ᚖstring(ctx, field.Selections, res) 2165 return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
932 } 2166 }
933 2167
  2168 +func (ec *executionContext) _Role_access(ctx context.Context, field graphql.CollectedField, obj *model.Role) (ret graphql.Marshaler) {
  2169 + defer func() {
  2170 + if r := recover(); r != nil {
  2171 + ec.Error(ctx, ec.Recover(ctx, r))
  2172 + ret = graphql.Null
  2173 + }
  2174 + }()
  2175 + fc := &graphql.FieldContext{
  2176 + Object: "Role",
  2177 + Field: field,
  2178 + Args: nil,
  2179 + IsMethod: true,
  2180 + IsResolver: true,
  2181 + }
  2182 +
  2183 + ctx = graphql.WithFieldContext(ctx, fc)
  2184 + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
  2185 + ctx = rctx // use context from middleware stack in children
  2186 + return ec.resolvers.Role().Access(rctx, obj)
  2187 + })
  2188 + if err != nil {
  2189 + ec.Error(ctx, err)
  2190 + return graphql.Null
  2191 + }
  2192 + if resTmp == nil {
  2193 + return graphql.Null
  2194 + }
  2195 + res := resTmp.([]*model.Access)
  2196 + fc.Result = res
  2197 + return ec.marshalOAccess2ᚕᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐAccessᚄ(ctx, field.Selections, res)
  2198 +}
  2199 +
934 func (ec *executionContext) _Users_name(ctx context.Context, field graphql.CollectedField, obj *model.Users) (ret graphql.Marshaler) { 2200 func (ec *executionContext) _Users_name(ctx context.Context, field graphql.CollectedField, obj *model.Users) (ret graphql.Marshaler) {
935 defer func() { 2201 defer func() {
936 if r := recover(); r != nil { 2202 if r := recover(); r != nil {
@@ -2307,8 +3573,28 @@ func (ec *executionContext) unmarshalInputlistUsersInput(ctx context.Context, ob @@ -2307,8 +3573,28 @@ func (ec *executionContext) unmarshalInputlistUsersInput(ctx context.Context, ob
2307 case "limit": 3573 case "limit":
2308 var err error 3574 var err error
2309 3575
2310 - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limit"))  
2311 - it.Limit, err = ec.unmarshalNInt2int(ctx, v) 3576 + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limit"))
  3577 + it.Limit, err = ec.unmarshalNInt2int(ctx, v)
  3578 + if err != nil {
  3579 + return it, err
  3580 + }
  3581 + }
  3582 + }
  3583 +
  3584 + return it, nil
  3585 +}
  3586 +
  3587 +func (ec *executionContext) unmarshalInputmenuAccessInput(ctx context.Context, obj interface{}) (model.MenuAccessInput, error) {
  3588 + var it model.MenuAccessInput
  3589 + var asMap = obj.(map[string]interface{})
  3590 +
  3591 + for k, v := range asMap {
  3592 + switch k {
  3593 + case "name":
  3594 + var err error
  3595 +
  3596 + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name"))
  3597 + it.Name, err = ec.unmarshalOString2ᚖstring(ctx, v)
2312 if err != nil { 3598 if err != nil {
2313 return it, err 3599 return it, err
2314 } 3600 }
@@ -2374,6 +3660,134 @@ func (ec *executionContext) unmarshalInputupdateUsersInput(ctx context.Context, @@ -2374,6 +3660,134 @@ func (ec *executionContext) unmarshalInputupdateUsersInput(ctx context.Context,
2374 3660
2375 // region **************************** object.gotpl **************************** 3661 // region **************************** object.gotpl ****************************
2376 3662
  3663 +var accessImplementors = []string{"Access"}
  3664 +
  3665 +func (ec *executionContext) _Access(ctx context.Context, sel ast.SelectionSet, obj *model.Access) graphql.Marshaler {
  3666 + fields := graphql.CollectFields(ec.OperationContext, sel, accessImplementors)
  3667 +
  3668 + out := graphql.NewFieldSet(fields)
  3669 + var invalids uint32
  3670 + for i, field := range fields {
  3671 + switch field.Name {
  3672 + case "__typename":
  3673 + out.Values[i] = graphql.MarshalString("Access")
  3674 + case "id":
  3675 + out.Values[i] = ec._Access_id(ctx, field, obj)
  3676 + case "parentId":
  3677 + out.Values[i] = ec._Access_parentId(ctx, field, obj)
  3678 + case "accessName":
  3679 + out.Values[i] = ec._Access_accessName(ctx, field, obj)
  3680 + case "accessCode":
  3681 + out.Values[i] = ec._Access_accessCode(ctx, field, obj)
  3682 + case "accessType":
  3683 + out.Values[i] = ec._Access_accessType(ctx, field, obj)
  3684 + case "sort":
  3685 + out.Values[i] = ec._Access_sort(ctx, field, obj)
  3686 + case "object":
  3687 + out.Values[i] = ec._Access_object(ctx, field, obj)
  3688 + case "action":
  3689 + out.Values[i] = ec._Access_action(ctx, field, obj)
  3690 + case "module":
  3691 + out.Values[i] = ec._Access_module(ctx, field, obj)
  3692 + case "icon":
  3693 + out.Values[i] = ec._Access_icon(ctx, field, obj)
  3694 + case "status":
  3695 + out.Values[i] = ec._Access_status(ctx, field, obj)
  3696 + case "user":
  3697 + field := field
  3698 + out.Concurrently(i, func() (res graphql.Marshaler) {
  3699 + defer func() {
  3700 + if r := recover(); r != nil {
  3701 + ec.Error(ctx, ec.Recover(ctx, r))
  3702 + }
  3703 + }()
  3704 + res = ec._Access_user(ctx, field, obj)
  3705 + return res
  3706 + })
  3707 + default:
  3708 + panic("unknown field " + strconv.Quote(field.Name))
  3709 + }
  3710 + }
  3711 + out.Dispatch()
  3712 + if invalids > 0 {
  3713 + return graphql.Null
  3714 + }
  3715 + return out
  3716 +}
  3717 +
  3718 +var clientPackageInfoImplementors = []string{"ClientPackageInfo"}
  3719 +
  3720 +func (ec *executionContext) _ClientPackageInfo(ctx context.Context, sel ast.SelectionSet, obj *domain.ClientPackageInfo) graphql.Marshaler {
  3721 + fields := graphql.CollectFields(ec.OperationContext, sel, clientPackageInfoImplementors)
  3722 +
  3723 + out := graphql.NewFieldSet(fields)
  3724 + var invalids uint32
  3725 + for i, field := range fields {
  3726 + switch field.Name {
  3727 + case "__typename":
  3728 + out.Values[i] = graphql.MarshalString("ClientPackageInfo")
  3729 + case "FileName":
  3730 + out.Values[i] = ec._ClientPackageInfo_FileName(ctx, field, obj)
  3731 + case "Path":
  3732 + out.Values[i] = ec._ClientPackageInfo_Path(ctx, field, obj)
  3733 + default:
  3734 + panic("unknown field " + strconv.Quote(field.Name))
  3735 + }
  3736 + }
  3737 + out.Dispatch()
  3738 + if invalids > 0 {
  3739 + return graphql.Null
  3740 + }
  3741 + return out
  3742 +}
  3743 +
  3744 +var clientVersionImplementors = []string{"ClientVersion"}
  3745 +
  3746 +func (ec *executionContext) _ClientVersion(ctx context.Context, sel ast.SelectionSet, obj *domain.ClientVersion) graphql.Marshaler {
  3747 + fields := graphql.CollectFields(ec.OperationContext, sel, clientVersionImplementors)
  3748 +
  3749 + out := graphql.NewFieldSet(fields)
  3750 + var invalids uint32
  3751 + for i, field := range fields {
  3752 + switch field.Name {
  3753 + case "__typename":
  3754 + out.Values[i] = graphql.MarshalString("ClientVersion")
  3755 + case "id":
  3756 + out.Values[i] = ec._ClientVersion_id(ctx, field, obj)
  3757 + case "commiter":
  3758 + out.Values[i] = ec._ClientVersion_commiter(ctx, field, obj)
  3759 + case "projectName":
  3760 + out.Values[i] = ec._ClientVersion_projectName(ctx, field, obj)
  3761 + case "version":
  3762 + out.Values[i] = ec._ClientVersion_version(ctx, field, obj)
  3763 + case "title":
  3764 + out.Values[i] = ec._ClientVersion_title(ctx, field, obj)
  3765 + case "remark":
  3766 + out.Values[i] = ec._ClientVersion_remark(ctx, field, obj)
  3767 + case "clientPackageInfo":
  3768 + out.Values[i] = ec._ClientVersion_clientPackageInfo(ctx, field, obj)
  3769 + case "createTime":
  3770 + field := field
  3771 + out.Concurrently(i, func() (res graphql.Marshaler) {
  3772 + defer func() {
  3773 + if r := recover(); r != nil {
  3774 + ec.Error(ctx, ec.Recover(ctx, r))
  3775 + }
  3776 + }()
  3777 + res = ec._ClientVersion_createTime(ctx, field, obj)
  3778 + return res
  3779 + })
  3780 + default:
  3781 + panic("unknown field " + strconv.Quote(field.Name))
  3782 + }
  3783 + }
  3784 + out.Dispatch()
  3785 + if invalids > 0 {
  3786 + return graphql.Null
  3787 + }
  3788 + return out
  3789 +}
  3790 +
2377 var mutationImplementors = []string{"Mutation"} 3791 var mutationImplementors = []string{"Mutation"}
2378 3792
2379 func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { 3793 func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
@@ -2404,6 +3818,8 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) @@ -2404,6 +3818,8 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
2404 if out.Values[i] == graphql.Null { 3818 if out.Values[i] == graphql.Null {
2405 invalids++ 3819 invalids++
2406 } 3820 }
  3821 + case "createMenu":
  3822 + out.Values[i] = ec._Mutation_createMenu(ctx, field)
2407 default: 3823 default:
2408 panic("unknown field " + strconv.Quote(field.Name)) 3824 panic("unknown field " + strconv.Quote(field.Name))
2409 } 3825 }
@@ -2455,6 +3871,42 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr @@ -2455,6 +3871,42 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
2455 res = ec._Query_users(ctx, field) 3871 res = ec._Query_users(ctx, field)
2456 return res 3872 return res
2457 }) 3873 })
  3874 + case "menus":
  3875 + field := field
  3876 + out.Concurrently(i, func() (res graphql.Marshaler) {
  3877 + defer func() {
  3878 + if r := recover(); r != nil {
  3879 + ec.Error(ctx, ec.Recover(ctx, r))
  3880 + }
  3881 + }()
  3882 + res = ec._Query_menus(ctx, field)
  3883 + return res
  3884 + })
  3885 + case "clientVersion":
  3886 + field := field
  3887 + out.Concurrently(i, func() (res graphql.Marshaler) {
  3888 + defer func() {
  3889 + if r := recover(); r != nil {
  3890 + ec.Error(ctx, ec.Recover(ctx, r))
  3891 + }
  3892 + }()
  3893 + res = ec._Query_clientVersion(ctx, field)
  3894 + if res == graphql.Null {
  3895 + atomic.AddUint32(&invalids, 1)
  3896 + }
  3897 + return res
  3898 + })
  3899 + case "menu":
  3900 + field := field
  3901 + out.Concurrently(i, func() (res graphql.Marshaler) {
  3902 + defer func() {
  3903 + if r := recover(); r != nil {
  3904 + ec.Error(ctx, ec.Recover(ctx, r))
  3905 + }
  3906 + }()
  3907 + res = ec._Query_menu(ctx, field)
  3908 + return res
  3909 + })
2458 case "__type": 3910 case "__type":
2459 out.Values[i] = ec._Query___type(ctx, field) 3911 out.Values[i] = ec._Query___type(ctx, field)
2460 case "__schema": 3912 case "__schema":
@@ -2491,6 +3943,17 @@ func (ec *executionContext) _Role(ctx context.Context, sel ast.SelectionSet, obj @@ -2491,6 +3943,17 @@ func (ec *executionContext) _Role(ctx context.Context, sel ast.SelectionSet, obj
2491 out.Values[i] = ec._Role_createTime(ctx, field, obj) 3943 out.Values[i] = ec._Role_createTime(ctx, field, obj)
2492 case "updateTime": 3944 case "updateTime":
2493 out.Values[i] = ec._Role_updateTime(ctx, field, obj) 3945 out.Values[i] = ec._Role_updateTime(ctx, field, obj)
  3946 + case "access":
  3947 + field := field
  3948 + out.Concurrently(i, func() (res graphql.Marshaler) {
  3949 + defer func() {
  3950 + if r := recover(); r != nil {
  3951 + ec.Error(ctx, ec.Recover(ctx, r))
  3952 + }
  3953 + }()
  3954 + res = ec._Role_access(ctx, field, obj)
  3955 + return res
  3956 + })
2494 default: 3957 default:
2495 panic("unknown field " + strconv.Quote(field.Name)) 3958 panic("unknown field " + strconv.Quote(field.Name))
2496 } 3959 }
@@ -2792,6 +4255,16 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o @@ -2792,6 +4255,16 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o
2792 4255
2793 // region ***************************** type.gotpl ***************************** 4256 // region ***************************** type.gotpl *****************************
2794 4257
  4258 +func (ec *executionContext) marshalNAccess2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐAccess(ctx context.Context, sel ast.SelectionSet, v *model.Access) graphql.Marshaler {
  4259 + if v == nil {
  4260 + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
  4261 + ec.Errorf(ctx, "must not be null")
  4262 + }
  4263 + return graphql.Null
  4264 + }
  4265 + return ec._Access(ctx, sel, v)
  4266 +}
  4267 +
2795 func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { 4268 func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) {
2796 res, err := graphql.UnmarshalBoolean(v) 4269 res, err := graphql.UnmarshalBoolean(v)
2797 return res, graphql.ErrorOnPath(ctx, err) 4270 return res, graphql.ErrorOnPath(ctx, err)
@@ -2807,6 +4280,30 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se @@ -2807,6 +4280,30 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se
2807 return res 4280 return res
2808 } 4281 }
2809 4282
  4283 +func (ec *executionContext) marshalNClientPackageInfo2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋdomainᚐClientPackageInfo(ctx context.Context, sel ast.SelectionSet, v *domain.ClientPackageInfo) graphql.Marshaler {
  4284 + if v == nil {
  4285 + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
  4286 + ec.Errorf(ctx, "must not be null")
  4287 + }
  4288 + return graphql.Null
  4289 + }
  4290 + return ec._ClientPackageInfo(ctx, sel, v)
  4291 +}
  4292 +
  4293 +func (ec *executionContext) marshalNClientVersion2githubᚗcomᚋtiptokᚋgodevpᚋpkgᚋdomainᚐClientVersion(ctx context.Context, sel ast.SelectionSet, v domain.ClientVersion) graphql.Marshaler {
  4294 + return ec._ClientVersion(ctx, sel, &v)
  4295 +}
  4296 +
  4297 +func (ec *executionContext) marshalNClientVersion2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋdomainᚐClientVersion(ctx context.Context, sel ast.SelectionSet, v *domain.ClientVersion) graphql.Marshaler {
  4298 + if v == nil {
  4299 + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
  4300 + ec.Errorf(ctx, "must not be null")
  4301 + }
  4302 + return graphql.Null
  4303 + }
  4304 + return ec._ClientVersion(ctx, sel, v)
  4305 +}
  4306 +
2810 func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { 4307 func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) {
2811 res, err := graphql.UnmarshalInt(v) 4308 res, err := graphql.UnmarshalInt(v)
2812 return res, graphql.ErrorOnPath(ctx, err) 4309 return res, graphql.ErrorOnPath(ctx, err)
@@ -3115,6 +4612,46 @@ func (ec *executionContext) unmarshalNupdateUsersInput2githubᚗcomᚋtiptokᚋg @@ -3115,6 +4612,46 @@ func (ec *executionContext) unmarshalNupdateUsersInput2githubᚗcomᚋtiptokᚋg
3115 return res, graphql.ErrorOnPath(ctx, err) 4612 return res, graphql.ErrorOnPath(ctx, err)
3116 } 4613 }
3117 4614
  4615 +func (ec *executionContext) marshalOAccess2ᚕᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐAccessᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Access) graphql.Marshaler {
  4616 + if v == nil {
  4617 + return graphql.Null
  4618 + }
  4619 + ret := make(graphql.Array, len(v))
  4620 + var wg sync.WaitGroup
  4621 + isLen1 := len(v) == 1
  4622 + if !isLen1 {
  4623 + wg.Add(len(v))
  4624 + }
  4625 + for i := range v {
  4626 + i := i
  4627 + fc := &graphql.FieldContext{
  4628 + Index: &i,
  4629 + Result: &v[i],
  4630 + }
  4631 + ctx := graphql.WithFieldContext(ctx, fc)
  4632 + f := func(i int) {
  4633 + defer func() {
  4634 + if r := recover(); r != nil {
  4635 + ec.Error(ctx, ec.Recover(ctx, r))
  4636 + ret = nil
  4637 + }
  4638 + }()
  4639 + if !isLen1 {
  4640 + defer wg.Done()
  4641 + }
  4642 + ret[i] = ec.marshalNAccess2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐAccess(ctx, sel, v[i])
  4643 + }
  4644 + if isLen1 {
  4645 + f(i)
  4646 + } else {
  4647 + go f(i)
  4648 + }
  4649 +
  4650 + }
  4651 + wg.Wait()
  4652 + return ret
  4653 +}
  4654 +
3118 func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { 4655 func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) {
3119 res, err := graphql.UnmarshalBoolean(v) 4656 res, err := graphql.UnmarshalBoolean(v)
3120 return res, graphql.ErrorOnPath(ctx, err) 4657 return res, graphql.ErrorOnPath(ctx, err)
@@ -3139,6 +4676,71 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast @@ -3139,6 +4676,71 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast
3139 return graphql.MarshalBoolean(*v) 4676 return graphql.MarshalBoolean(*v)
3140 } 4677 }
3141 4678
  4679 +func (ec *executionContext) marshalOClientPackageInfo2ᚕᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋdomainᚐClientPackageInfoᚄ(ctx context.Context, sel ast.SelectionSet, v []*domain.ClientPackageInfo) graphql.Marshaler {
  4680 + if v == nil {
  4681 + return graphql.Null
  4682 + }
  4683 + ret := make(graphql.Array, len(v))
  4684 + var wg sync.WaitGroup
  4685 + isLen1 := len(v) == 1
  4686 + if !isLen1 {
  4687 + wg.Add(len(v))
  4688 + }
  4689 + for i := range v {
  4690 + i := i
  4691 + fc := &graphql.FieldContext{
  4692 + Index: &i,
  4693 + Result: &v[i],
  4694 + }
  4695 + ctx := graphql.WithFieldContext(ctx, fc)
  4696 + f := func(i int) {
  4697 + defer func() {
  4698 + if r := recover(); r != nil {
  4699 + ec.Error(ctx, ec.Recover(ctx, r))
  4700 + ret = nil
  4701 + }
  4702 + }()
  4703 + if !isLen1 {
  4704 + defer wg.Done()
  4705 + }
  4706 + ret[i] = ec.marshalNClientPackageInfo2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋdomainᚐClientPackageInfo(ctx, sel, v[i])
  4707 + }
  4708 + if isLen1 {
  4709 + f(i)
  4710 + } else {
  4711 + go f(i)
  4712 + }
  4713 +
  4714 + }
  4715 + wg.Wait()
  4716 + return ret
  4717 +}
  4718 +
  4719 +func (ec *executionContext) unmarshalODate2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋlibsᚐDatetime(ctx context.Context, v interface{}) (*libs.Datetime, error) {
  4720 + if v == nil {
  4721 + return nil, nil
  4722 + }
  4723 + var res = new(libs.Datetime)
  4724 + err := res.UnmarshalGQL(v)
  4725 + return res, graphql.ErrorOnPath(ctx, err)
  4726 +}
  4727 +
  4728 +func (ec *executionContext) marshalODate2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋlibsᚐDatetime(ctx context.Context, sel ast.SelectionSet, v *libs.Datetime) graphql.Marshaler {
  4729 + if v == nil {
  4730 + return graphql.Null
  4731 + }
  4732 + return v
  4733 +}
  4734 +
  4735 +func (ec *executionContext) unmarshalOInt2int64(ctx context.Context, v interface{}) (int64, error) {
  4736 + res, err := graphql.UnmarshalInt64(v)
  4737 + return res, graphql.ErrorOnPath(ctx, err)
  4738 +}
  4739 +
  4740 +func (ec *executionContext) marshalOInt2int64(ctx context.Context, sel ast.SelectionSet, v int64) graphql.Marshaler {
  4741 + return graphql.MarshalInt64(v)
  4742 +}
  4743 +
3142 func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v interface{}) (*int, error) { 4744 func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v interface{}) (*int, error) {
3143 if v == nil { 4745 if v == nil {
3144 return nil, nil 4746 return nil, nil
@@ -3258,6 +4860,13 @@ func (ec *executionContext) marshalOUsers2ᚕᚖgithubᚗcomᚋtiptokᚋgodevp @@ -3258,6 +4860,13 @@ func (ec *executionContext) marshalOUsers2ᚕᚖgithubᚗcomᚋtiptokᚋgodevp
3258 return ret 4860 return ret
3259 } 4861 }
3260 4862
  4863 +func (ec *executionContext) marshalOUsers2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐUsers(ctx context.Context, sel ast.SelectionSet, v *model.Users) graphql.Marshaler {
  4864 + if v == nil {
  4865 + return graphql.Null
  4866 + }
  4867 + return ec._Users(ctx, sel, v)
  4868 +}
  4869 +
3261 func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { 4870 func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler {
3262 if v == nil { 4871 if v == nil {
3263 return graphql.Null 4872 return graphql.Null
@@ -3432,4 +5041,12 @@ func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen @@ -3432,4 +5041,12 @@ func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen
3432 return ec.___Type(ctx, sel, v) 5041 return ec.___Type(ctx, sel, v)
3433 } 5042 }
3434 5043
  5044 +func (ec *executionContext) unmarshalOmenuAccessInput2ᚖgithubᚗcomᚋtiptokᚋgodevpᚋpkgᚋportᚋgraphqlᚋgraphᚋmodelᚐMenuAccessInput(ctx context.Context, v interface{}) (*model.MenuAccessInput, error) {
  5045 + if v == nil {
  5046 + return nil, nil
  5047 + }
  5048 + res, err := ec.unmarshalInputmenuAccessInput(ctx, v)
  5049 + return &res, graphql.ErrorOnPath(ctx, err)
  5050 +}
  5051 +
3435 // endregion ***************************** type.gotpl ***************************** 5052 // endregion ***************************** type.gotpl *****************************
  1 +package libs
  2 +
  3 +import (
  4 + "encoding/json"
  5 + "fmt"
  6 + "io"
  7 + "net/url"
  8 + "time"
  9 +)
  10 +
  11 +type Datetime struct {
  12 + t time.Time
  13 +}
  14 +
  15 +const TimeLayout = "2006-01-02T15:04:05.000Z"
  16 +
  17 +func NewDatetimeFromTime(t time.Time) *Datetime {
  18 + return &Datetime{
  19 + t: t,
  20 + }
  21 +}
  22 +
  23 +func (d *Datetime) GetTime() time.Time {
  24 + return d.t
  25 +}
  26 +
  27 +func (d *Datetime) UnmarshalGQL(vi interface{}) (err error) {
  28 + v, ok := vi.(string)
  29 + if !ok {
  30 + return fmt.Errorf("unknown type of Datetime: `%+v`", vi)
  31 + }
  32 + if d.t, err = time.Parse(TimeLayout, v); err != nil {
  33 + return err
  34 + }
  35 +
  36 + return nil
  37 +}
  38 +
  39 +func (d Datetime) MarshalGQL(w io.Writer) {
  40 + if _, err := w.Write(appendQuote([]byte(d.t.Format(TimeLayout)))); err != nil {
  41 + //Logger.Error("write datetime bytes", zap.Error(err))
  42 + }
  43 +}
  44 +
  45 +type QuotedString string
  46 +
  47 +func (qs *QuotedString) UnmarshalGQL(vi interface{}) (err error) {
  48 + switch v := vi.(type) {
  49 + case string:
  50 + if v, err = url.QueryUnescape(v); err != nil {
  51 + //Logger.Debug("unquote string", zap.String("quoted", v), zap.Error(err))
  52 + return err
  53 + }
  54 + *qs = QuotedString(v)
  55 + return nil
  56 + }
  57 +
  58 + //Logger.Debug("unknown type of QuotedString", zap.String("quoted", fmt.Sprint(vi)))
  59 + return fmt.Errorf("unknown type of QuotedString: `%+v`", vi)
  60 +}
  61 +
  62 +func (qs QuotedString) MarshalGQL(w io.Writer) {
  63 + if _, err := w.Write(appendQuote([]byte(qs))); err != nil {
  64 + //Logger.Error("write bytes", zap.Error(err))
  65 + }
  66 +}
  67 +
  68 +type JSONString string
  69 +
  70 +func (qs *JSONString) UnmarshalGQL(vi interface{}) (err error) {
  71 + v, ok := vi.(string)
  72 + if !ok {
  73 + //Logger.Debug("unknown type of JSONString", zap.String("val", fmt.Sprint(vi)))
  74 + }
  75 + // var v string
  76 + //if err = json.UnmarshalFromString(v, &v); err != nil {
  77 + // //Logger.Debug("decode string", zap.String("quoted", v), zap.Error(err))
  78 + // return err
  79 + //}
  80 +
  81 + *qs = JSONString(v)
  82 + return nil
  83 +}
  84 +
  85 +func (qs JSONString) MarshalGQL(w io.Writer) {
  86 + if vb, err := json.Marshal(qs); err != nil {
  87 + //Logger.Error("marshal json", zap.Error(err))
  88 + } else {
  89 + if _, err = w.Write(vb); err != nil {
  90 + //Logger.Error("write bytes", zap.Error(err))
  91 + }
  92 + }
  93 +}
  1 +package libs
  2 +
  3 +func appendQuote(v []byte) []byte {
  4 + r := []byte("\"")
  5 + r = append(r, v...)
  6 + r = append(r, '"')
  7 + return r
  8 +}
  1 +package model
  2 +
  3 +type Access struct {
  4 + ID *int `json:"id"`
  5 + ParentID *int `json:"parentId"`
  6 + AccessName *string `json:"accessName"`
  7 + AccessCode *string `json:"accessCode"`
  8 + AccessType *string `json:"accessType"`
  9 + Sort *int `json:"sort"`
  10 + Object *string `json:"object"`
  11 + Action *string `json:"action"`
  12 + Module *string `json:"module"`
  13 + Icon *string `json:"icon"`
  14 + Status *int `json:"status"`
  15 + User *int `json:"user"`
  16 +}
@@ -2,14 +2,6 @@ @@ -2,14 +2,6 @@
2 2
3 package model 3 package model
4 4
5 -type Role struct {  
6 - ID *int `json:"id"`  
7 - RoleName *string `json:"roleName"`  
8 - ParentID *int `json:"parentId"`  
9 - CreateTime *string `json:"createTime"`  
10 - UpdateTime *string `json:"updateTime"`  
11 -}  
12 -  
13 type CreateUsersInput struct { 5 type CreateUsersInput struct {
14 Name string `json:"name"` 6 Name string `json:"name"`
15 Phone string `json:"phone"` 7 Phone string `json:"phone"`
@@ -24,6 +16,10 @@ type ListUsersInput struct { @@ -24,6 +16,10 @@ type ListUsersInput struct {
24 Limit int `json:"limit"` 16 Limit int `json:"limit"`
25 } 17 }
26 18
  19 +type MenuAccessInput struct {
  20 + Name *string `json:"name"`
  21 +}
  22 +
27 type RemoveUsersInput struct { 23 type RemoveUsersInput struct {
28 ID int `json:"id"` 24 ID int `json:"id"`
29 } 25 }
  1 +package model
  2 +
  3 +type Role struct {
  4 + ID *int `json:"id"`
  5 + RoleName *string `json:"roleName"`
  6 + ParentID *int `json:"parentId"`
  7 + CreateTime *string `json:"createTime"`
  8 + UpdateTime *string `json:"updateTime"`
  9 + Access []*int `json:"access"`
  10 +}
  1 +scalar Date
  2 +
1 ## type 3 ## type
2 type Users{ 4 type Users{
3 name: String 5 name: String
@@ -14,6 +16,22 @@ type Role{ @@ -14,6 +16,22 @@ type Role{
14 parentId: Int 16 parentId: Int
15 createTime: String 17 createTime: String
16 updateTime: String 18 updateTime: String
  19 + access:[Access!]
  20 +}
  21 +type ClientVersion{
  22 + id: Int
  23 + commiter: String
  24 + projectName: String
  25 + version: String
  26 + title: String
  27 + remark: String
  28 + clientPackageInfo: [ClientPackageInfo!]
  29 + createTime: Date
  30 +}
  31 +
  32 +type ClientPackageInfo{
  33 + FileName: String
  34 + Path: String
17 } 35 }
18 36
19 ## user input 37 ## user input
@@ -39,6 +57,10 @@ input listUsersInput{ @@ -39,6 +57,10 @@ input listUsersInput{
39 type Query { 57 type Query {
40 user(input : getUsersInput!): Users! 58 user(input : getUsersInput!): Users!
41 users(input : listUsersInput!): [Users!] 59 users(input : listUsersInput!): [Users!]
  60 +
  61 + menus(input: menuAccessInput): [Access!]
  62 +
  63 + clientVersion(id :Int):ClientVersion!
42 } 64 }
43 65
44 type Mutation{ 66 type Mutation{
@@ -6,17 +6,27 @@ package graph @@ -6,17 +6,27 @@ package graph
6 import ( 6 import (
7 "context" 7 "context"
8 "fmt" 8 "fmt"
  9 + query2 "github.com/tiptok/godevp/pkg/application/clientVersion/query"
  10 + "unsafe"
9 11
10 "github.com/tiptok/gocomm/common" 12 "github.com/tiptok/gocomm/common"
  13 + clientVersionService "github.com/tiptok/godevp/pkg/application/clientVersion/service"
  14 + "github.com/tiptok/godevp/pkg/application/factory"
11 "github.com/tiptok/godevp/pkg/application/users/command" 15 "github.com/tiptok/godevp/pkg/application/users/command"
12 "github.com/tiptok/godevp/pkg/application/users/query" 16 "github.com/tiptok/godevp/pkg/application/users/query"
13 "github.com/tiptok/godevp/pkg/application/users/service" 17 "github.com/tiptok/godevp/pkg/application/users/service"
  18 + domain1 "github.com/tiptok/godevp/pkg/domain"
14 "github.com/tiptok/godevp/pkg/domain/role" 19 "github.com/tiptok/godevp/pkg/domain/role"
15 domain "github.com/tiptok/godevp/pkg/domain/users" 20 domain "github.com/tiptok/godevp/pkg/domain/users"
16 "github.com/tiptok/godevp/pkg/port/graphql/graph/generated" 21 "github.com/tiptok/godevp/pkg/port/graphql/graph/generated"
  22 + "github.com/tiptok/godevp/pkg/port/graphql/graph/libs"
17 "github.com/tiptok/godevp/pkg/port/graphql/graph/model" 23 "github.com/tiptok/godevp/pkg/port/graphql/graph/model"
18 ) 24 )
19 25
  26 +func (r *clientVersionResolver) CreateTime(ctx context.Context, obj *domain1.ClientVersion) (*libs.Datetime, error) {
  27 + return libs.NewDatetimeFromTime(obj.CreateTime), nil
  28 +}
  29 +
20 func (r *mutationResolver) CreateUsers(ctx context.Context, input model.CreateUsersInput) (*model.Users, error) { 30 func (r *mutationResolver) CreateUsers(ctx context.Context, input model.CreateUsersInput) (*model.Users, error) {
21 usersService := service.NewUsersService(nil) 31 usersService := service.NewUsersService(nil)
22 createUsersCommand := &command.CreateUsersCommand{ 32 createUsersCommand := &command.CreateUsersCommand{
@@ -93,6 +103,44 @@ func (r *queryResolver) Users(ctx context.Context, input model.ListUsersInput) ( @@ -93,6 +103,44 @@ func (r *queryResolver) Users(ctx context.Context, input model.ListUsersInput) (
93 return nil, fmt.Errorf("type error except: domain.Users") 103 return nil, fmt.Errorf("type error except: domain.Users")
94 } 104 }
95 105
  106 +func (r *queryResolver) Menus(ctx context.Context, input *model.MenuAccessInput) ([]*model.Access, error) {
  107 + transactionContext, _ := factory.CreateDefaultTransactionContext(nil)
  108 + var AccessRepository, _ = factory.CreateAccessRepository(map[string]interface{}{"transactionContext": transactionContext})
  109 + _, access, _ := AccessRepository.Find(map[string]interface{}{})
  110 + var rsp []*model.Access
  111 + for _, item := range access {
  112 + rsp = append(rsp, &model.Access{
  113 + ID: (*int)(unsafe.Pointer(&item.Id)),
  114 + ParentID: (*int)(unsafe.Pointer(&item.ParentId)),
  115 + AccessName: &item.AccessName,
  116 + AccessCode: &item.AccessCode,
  117 + AccessType: &item.AccessType,
  118 + Sort: (*int)(unsafe.Pointer(&item.Sort)),
  119 + Object: &item.Object,
  120 + Action: &item.Action,
  121 + Module: &item.Module,
  122 + Icon: &item.Icon,
  123 + Status: (*int)(unsafe.Pointer(&item.Status)),
  124 + })
  125 + }
  126 + return rsp, nil
  127 +}
  128 +
  129 +func (r *queryResolver) ClientVersion(ctx context.Context, id *int) (*domain1.ClientVersion, error) {
  130 + svr := clientVersionService.NewClientVersionService(nil)
  131 + m, err := svr.GetClientVersion(&query2.GetClientVersionQuery{Id: int64(*id)})
  132 + if err != nil || m == nil {
  133 + return nil, err
  134 + }
  135 + return m.(*domain1.ClientVersion), nil
  136 +}
  137 +
  138 +func (r *roleResolver) Access(ctx context.Context, obj *model.Role) ([]*model.Access, error) {
  139 + return []*model.Access{
  140 + &model.Access{},
  141 + }, nil
  142 +}
  143 +
96 func (r *usersResolver) Roles(ctx context.Context, obj *model.Users) ([]*model.Role, error) { 144 func (r *usersResolver) Roles(ctx context.Context, obj *model.Users) ([]*model.Role, error) {
97 var ro = &role.Role{ 145 var ro = &role.Role{
98 Id: 1, 146 Id: 1,
@@ -112,15 +160,23 @@ func (r *usersResolver) Roles(ctx context.Context, obj *model.Users) ([]*model.R @@ -112,15 +160,23 @@ func (r *usersResolver) Roles(ctx context.Context, obj *model.Users) ([]*model.R
112 }, nil 160 }, nil
113 } 161 }
114 162
  163 +// ClientVersion returns generated.ClientVersionResolver implementation.
  164 +func (r *Resolver) ClientVersion() generated.ClientVersionResolver { return &clientVersionResolver{r} }
  165 +
115 // Mutation returns generated.MutationResolver implementation. 166 // Mutation returns generated.MutationResolver implementation.
116 func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} } 167 func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResolver{r} }
117 168
118 // Query returns generated.QueryResolver implementation. 169 // Query returns generated.QueryResolver implementation.
119 func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} } 170 func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }
120 171
  172 +// Role returns generated.RoleResolver implementation.
  173 +func (r *Resolver) Role() generated.RoleResolver { return &roleResolver{r} }
  174 +
121 // Users returns generated.UsersResolver implementation. 175 // Users returns generated.UsersResolver implementation.
122 func (r *Resolver) Users() generated.UsersResolver { return &usersResolver{r} } 176 func (r *Resolver) Users() generated.UsersResolver { return &usersResolver{r} }
123 177
  178 +type clientVersionResolver struct{ *Resolver }
124 type mutationResolver struct{ *Resolver } 179 type mutationResolver struct{ *Resolver }
125 type queryResolver struct{ *Resolver } 180 type queryResolver struct{ *Resolver }
  181 +type roleResolver struct{ *Resolver }
126 type usersResolver struct{ *Resolver } 182 type usersResolver struct{ *Resolver }