(m schema.Mutation)
| 46 | } |
| 47 | |
| 48 | func 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 | } |
no test coverage detected