Add delete mutation

This commit is contained in:
Vikram Rangnekar
2019-09-06 01:17:45 -04:00
parent e765176bfa
commit fe4d1107ac
4 changed files with 75 additions and 39 deletions

View File

@ -664,10 +664,18 @@ func (com *Compiler) compileArgOffset(sel *Select, arg *Arg) error {
}
func (com *Compiler) compileArgAction(sel *Select, arg *Arg) error {
if arg.Val.Type != nodeVar {
return fmt.Errorf("value for argument '%s' must be a variable", arg.Name)
switch sel.Action {
case ActionDelete:
if arg.Val.Type != nodeBool {
return fmt.Errorf("value for argument '%s' must be a boolean", arg.Name)
}
default:
if arg.Val.Type != nodeVar {
return fmt.Errorf("value for argument '%s' must be a variable", arg.Name)
}
sel.ActionVar = arg.Val.Val
}
sel.ActionVar = arg.Val.Val
return nil
}