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

Function queryAndPrintUser

acl/acl.go:586–601  ·  view source on GitHub ↗
(ctx context.Context, txn *dgo.Txn, userId string)

Source from the content-addressed store, hash-verified

584}
585
586func queryAndPrintUser(ctx context.Context, txn *dgo.Txn, userId string) error {
587 user, err := queryUser(ctx, txn, userId)
588 if err != nil {
589 return err
590 }
591 if user == nil {
592 return fmt.Errorf("the user %q does not exist", userId)
593 }
594
595 fmt.Printf("User : %s\n", userId)
596 fmt.Printf("UID : %s\n", user.Uid)
597 for _, group := range user.Groups {
598 fmt.Printf("Group : %-5s\n", group.GroupID)
599 }
600 return nil
601}
602
603func queryAndPrintGroup(ctx context.Context, txn *dgo.Txn, groupId string) error {
604 group, err := queryGroup(ctx, txn, groupId, "dgraph.xid", "~dgraph.user.group{dgraph.xid}",

Callers 2

userModFunction · 0.85
infoFunction · 0.85

Calls 2

queryUserFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected