Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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*/
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ go:
before_install:
- go get github.com/mattn/goveralls
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.15.0
- env GO111MODULE=on go get ./cmd/goqueryset
script:
- env GO111MODULE=on make test
- env GO111MODULE=on $HOME/gopath/bin/goveralls -ignore "internal/queryset/generator/test/autogenerated_models.go,examples/comparison/*/*.go,internal/queryset/generator/test/pkgimport/*.go,internal/queryset/generator/test/pkgimport/*/*/*.go" -v -service=travis-ci
- make clean_autogenerated
- env GO111MODULE=on make gen
- test -z "$(git status -s)" && exit 0
- echo "Folowing modules should be regenerated:\n$(git status -s)\n"
- echo "Call 'make gen' to fix this issue."
- exit 1
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ gen:
@- $(foreach F,$(AUTOGEN_FILES), \
go generate $$(dirname $F); \
)

clean_autogenerated:
@rm -f $(AUTOGEN_FILES)
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
10 changes: 9 additions & 1 deletion internal/queryset/field/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func (g InfoGenerator) GenFieldInfo(f Field) *Info {
}
}

const byteType = "byte"
switch t := f.Type().(type) {
case *types.Basic:
bi.IsString = t.Info()&types.IsString != 0
Expand All @@ -125,7 +126,14 @@ func (g InfoGenerator) GenFieldInfo(f Field) *Info {
BaseInfo: bi,
}
case *types.Slice:
if t.Elem().String() == "byte" {
if t.Elem().String() == byteType {
return &Info{
BaseInfo: bi,
}
}
return nil
case *types.Array:
if t.Elem().String() == byteType {
return &Info{
BaseInfo: bi,
}
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