MCPcopy
hub / github.com/dgraph-io/dgraph / queryUser

Function queryUser

acl/acl.go:512–537  ·  view source on GitHub ↗
(ctx context.Context, txn *dgo.Txn, userid string)

Source from the content-addressed store, hash-verified

510}
511
512func 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
539func getUserModNQuad(ctx context.Context, txn *dgo.Txn, userId string,
540 groupId string) (*api.NQuad, error) {

Callers 5

userAddFunction · 0.85
delFunction · 0.85
changePasswordFunction · 0.85
userModFunction · 0.85
queryAndPrintUserFunction · 0.85

Calls 2

UnmarshalUserFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected