Skip to content

Commit

Permalink
Fixed arrays support; fixes #52
Browse files Browse the repository at this point in the history
  • Loading branch information
derElektrobesen committed Oct 1, 2019
1 parent 9132023 commit 7f9778d
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*~
*.swp
/go-queryset
/vendor
/internal/parser/test/tmptestdir*/
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/lib/pq v1.0.0 // indirect
github.com/mattn/go-sqlite3 v1.10.0 // indirect
github.com/pkg/errors v0.8.1
github.com/satori/go.uuid v1.2.0
github.com/stretchr/testify v1.3.0
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 // indirect
golang.org/x/tools v0.0.0-20190226205152-f727befe758c
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM=
Expand Down
7 changes: 7 additions & 0 deletions internal/queryset/field/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ func (g InfoGenerator) GenFieldInfo(f Field) *Info {
}
}
return nil
case *types.Array:
if t.Elem().String() == "byte" {
return &Info{
BaseInfo: bi,
}
}
return nil
case *types.Named:
r := g.GenFieldInfo(field{
name: f.Name(),
Expand Down
55 changes: 55 additions & 0 deletions internal/queryset/generator/test/pkgimport/autogenerated_models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions internal/queryset/generator/test/pkgimport/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ package models
import (
forex "github.com/jirfag/go-queryset/internal/queryset/generator/test/pkgimport/forex/v1"
forexAlias "github.com/jirfag/go-queryset/internal/queryset/generator/test/pkgimport/forex/v1"
uuid "github.com/satori/go.uuid"
)

// Example is a test struct
// gen:qs
type Example struct {
ID uuid.UUID
PriceID int64
Currency1 forexAlias.Currency1
Currency2 forex.Currency2
Expand Down

0 comments on commit 7f9778d

Please sign in to comment.