(ctx context.Context, txn *dgo.Txn, userid string)
| 510 | } |
| 511 | |
| 512 | func queryUser(ctx context.Context, txn *dgo.Txn, userid string) (user *User, err error) { |
| 513 | query := ` |
| 514 | query search($userid: string){ |
| 515 | user(func: eq(dgraph.xid, $userid)) @filter(type(dgraph.type.User)) { |
| 516 | uid |
| 517 | dgraph.xid |
| 518 | dgraph.user.group { |
| 519 | uid |
| 520 | dgraph.xid |
| 521 | } |
| 522 | } |
| 523 | }` |
| 524 | |
| 525 | queryVars := make(map[string]string) |
| 526 | queryVars["$userid"] = userid |
| 527 | |
| 528 | queryResp, err := txn.QueryWithVars(ctx, query, queryVars) |
| 529 | if err != nil { |
| 530 | return nil, fmt.Errorf("while query user with id %s: %w", userid, err) |
| 531 | } |
| 532 | user, err = UnmarshalUser(queryResp, "user") |
| 533 | if err != nil { |
| 534 | return nil, err |
| 535 | } |
| 536 | return user, nil |
| 537 | } |
| 538 | |
| 539 | func getUserModNQuad(ctx context.Context, txn *dgo.Txn, userId string, |
| 540 | groupId string) (*api.NQuad, error) { |
no test coverage detected