Skip to content

Commit

Permalink
mars-gen: Add support for route generation when any params are used.
Browse files Browse the repository at this point in the history
  • Loading branch information
roblillack committed Apr 29, 2022
1 parent d02d214 commit 94d2c9e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
28 changes: 16 additions & 12 deletions cmd/mars-gen/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ import (
)

var TypeExprs = map[string]TypeExpr{
"int": {"int", "", 0, true},
"*int": {"*int", "", 1, true},
"[]int": {"[]int", "", 2, true},
"...int": {"[]int", "", 2, true},
"[]*int": {"[]*int", "", 3, true},
"...*int": {"[]*int", "", 3, true},
"MyType": {"MyType", "pkg", 0, true},
"*MyType": {"*MyType", "pkg", 1, true},
"[]MyType": {"[]MyType", "pkg", 2, true},
"...MyType": {"[]MyType", "pkg", 2, true},
"[]*MyType": {"[]*MyType", "pkg", 3, true},
"...*MyType": {"[]*MyType", "pkg", 3, true},
"int": {"int", "", 0, true},
"*int": {"*int", "", 1, true},
"[]int": {"[]int", "", 2, true},
"...int": {"[]int", "", 2, true},
"[]*int": {"[]*int", "", 3, true},
"...*int": {"[]*int", "", 3, true},
"MyType": {"MyType", "pkg", 0, true},
"*MyType": {"*MyType", "pkg", 1, true},
"[]MyType": {"[]MyType", "pkg", 2, true},
"...MyType": {"[]MyType", "pkg", 2, true},
"[]*MyType": {"[]*MyType", "pkg", 3, true},
"...*MyType": {"[]*MyType", "pkg", 3, true},
"interface{}": {"interface{}", "", 0, true},
"...interface{}": {"[]interface{}", "", 2, true},
"any": {"any", "", 0, true},
"...any": {"[]any", "", 2, true},
}

func TestTypeExpr(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions cmd/mars-gen/reflect.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,4 +631,5 @@ var builtinTypes = map[string]struct{}{
"uint64": {},
"uint8": {},
"uintptr": {},
"any": {},
}

0 comments on commit 94d2c9e

Please sign in to comment.