Skip to content

Commit 5a815b5

Browse files
authored
fixed cascade with predicates@ (#5)
1 parent 7ac279a commit 5a815b5

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

expression.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -729,13 +729,7 @@ func Cascade(fields ...string) DQLizer {
729729
// ToDQL returns the DQL statement for the 'cascade' expression
730730
func (cascade cascadeExpr) ToDQL() (query string, args []interface{}, err error) {
731731
if len(cascade.fields) > 0 {
732-
fields := make([]string, len(cascade.fields))
733-
734-
for index, field := range cascade.fields {
735-
fields[index] = fmt.Sprintf(`"%s"`, field)
736-
}
737-
738-
return fmt.Sprintf("@cascade(fields: [%s])", strings.Join(fields, ",")), nil, nil
732+
return fmt.Sprintf("@cascade(%s)", strings.Join(cascade.fields, ",")), nil, nil
739733
}
740734

741735
return "@cascade", nil, nil

query_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ func Test_Cascade(t *testing.T) {
665665
<name>
666666
<initial_release_date>
667667
<netflix_id>
668-
<films> @cascade(fields: ["date","id"]) {
668+
<films> @cascade(date,id) {
669669
<id>
670670
<date>
671671
}

0 commit comments

Comments
 (0)