MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / getMoveTabletInput

Function getMoveTabletInput

graphql/admin/moveTablet.go:48–79  ·  view source on GitHub ↗
(m schema.Mutation)

Source from the content-addressed store, hash-verified

46}
47
48func getMoveTabletInput(m schema.Mutation) (*moveTabletInput, error) {
49 inputArg, ok := m.ArgValue(schema.InputArgName).(map[string]interface{})
50 if !ok {
51 return nil, inputArgError(errors.Errorf("can't convert input to map"))
52 }
53
54 inputRef := &moveTabletInput{}
55 // namespace is an optional parameter
56 if _, ok = inputArg["namespace"]; !ok {
57 inputRef.Namespace = x.RootNamespace
58 } else {
59 ns, err := parseAsUint64(inputArg["namespace"])
60 if err != nil {
61 return nil, inputArgError(schema.GQLWrapf(err,
62 "can't convert input.namespace to uint64"))
63 }
64 inputRef.Namespace = ns
65 }
66
67 inputRef.Tablet, ok = inputArg["tablet"].(string)
68 if !ok {
69 return nil, inputArgError(errors.Errorf("can't convert input.tablet to string"))
70 }
71
72 gId, err := parseAsUint32(inputArg["groupId"])
73 if err != nil {
74 return nil, inputArgError(schema.GQLWrapf(err, "can't convert input.groupId to uint32"))
75 }
76 inputRef.GroupId = gId
77
78 return inputRef, nil
79}

Callers 1

resolveMoveTabletFunction · 0.85

Calls 6

GQLWrapfFunction · 0.92
inputArgErrorFunction · 0.85
parseAsUint64Function · 0.85
parseAsUint32Function · 0.85
ArgValueMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected