add coord filters
This commit is contained in:
parent
4d381a8e68
commit
917780f737
2
go.mod
2
go.mod
|
@ -13,7 +13,7 @@ require (
|
|||
github.com/modern-go/reflect2 v1.0.1 // indirect
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/segmentio/encoding v0.1.13 // indirect
|
||||
github.com/tribalwarshelp/shared v0.0.0-20200618135703-8b0fda79025b
|
||||
github.com/tribalwarshelp/shared v0.0.0-20200618150949-896cd6c98d06
|
||||
github.com/vektah/gqlparser/v2 v2.0.1
|
||||
golang.org/x/net v0.0.0-20200602114024-627f9648deb9 // indirect
|
||||
golang.org/x/sys v0.0.0-20200602100848-8d3cce7afc34 // indirect
|
||||
|
|
4
go.sum
4
go.sum
|
@ -168,8 +168,8 @@ github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H
|
|||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
|
||||
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
|
||||
github.com/tribalwarshelp/shared v0.0.0-20200618135703-8b0fda79025b h1:megohIF+3rsva+9CNxlhdAbMKX0kjUaig2P5TSxH0fQ=
|
||||
github.com/tribalwarshelp/shared v0.0.0-20200618135703-8b0fda79025b/go.mod h1:tf+2yTHasV6jAF3V2deZ9slNoCyBzC0fMdTjI7clf6Y=
|
||||
github.com/tribalwarshelp/shared v0.0.0-20200618150949-896cd6c98d06 h1:T87o4fice0XTUdAG/tctFCDiuyUGb10bY1hdWvwlrro=
|
||||
github.com/tribalwarshelp/shared v0.0.0-20200618150949-896cd6c98d06/go.mod h1:tf+2yTHasV6jAF3V2deZ9slNoCyBzC0fMdTjI7clf6Y=
|
||||
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
|
||||
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
||||
|
|
|
@ -34,7 +34,7 @@ func Attach(cfg Config) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Defining the Graphql handler
|
||||
// Defining the GraphQL handler
|
||||
func graphqlHandler(r *resolvers.Resolver) gin.HandlerFunc {
|
||||
cfg := generated.Config{Resolvers: r}
|
||||
srv := handler.New(generated.NewExecutableSchema(cfg))
|
||||
|
|
|
@ -1146,6 +1146,15 @@ input VillageFilter {
|
|||
pointsLT: Int
|
||||
pointsLTE: Int
|
||||
|
||||
xGT: Int
|
||||
xGTE: Int
|
||||
xLT: Int
|
||||
xLTE: Int
|
||||
yGT: Int
|
||||
yGTE: Int
|
||||
yLT: Int
|
||||
yLTE: Int
|
||||
|
||||
bonus: Int
|
||||
bonusGT: Int
|
||||
bonusGTE: Int
|
||||
|
@ -6015,6 +6024,54 @@ func (ec *executionContext) unmarshalInputVillageFilter(ctx context.Context, obj
|
|||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "xGT":
|
||||
var err error
|
||||
it.XGT, err = ec.unmarshalOInt2int(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "xGTE":
|
||||
var err error
|
||||
it.XGTE, err = ec.unmarshalOInt2int(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "xLT":
|
||||
var err error
|
||||
it.XLT, err = ec.unmarshalOInt2int(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "xLTE":
|
||||
var err error
|
||||
it.XLTE, err = ec.unmarshalOInt2int(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "yGT":
|
||||
var err error
|
||||
it.YGT, err = ec.unmarshalOInt2int(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "yGTE":
|
||||
var err error
|
||||
it.YGTE, err = ec.unmarshalOInt2int(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "yLT":
|
||||
var err error
|
||||
it.YLT, err = ec.unmarshalOInt2int(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "yLTE":
|
||||
var err error
|
||||
it.YLTE, err = ec.unmarshalOInt2int(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
case "bonus":
|
||||
var err error
|
||||
it.Bonus, err = ec.unmarshalOInt2int(ctx, v)
|
||||
|
|
|
@ -28,6 +28,15 @@ input VillageFilter {
|
|||
pointsLT: Int
|
||||
pointsLTE: Int
|
||||
|
||||
xGT: Int
|
||||
xGTE: Int
|
||||
xLT: Int
|
||||
xLTE: Int
|
||||
yGT: Int
|
||||
yGTE: Int
|
||||
yLT: Int
|
||||
yLTE: Int
|
||||
|
||||
bonus: Int
|
||||
bonusGT: Int
|
||||
bonusGTE: Int
|
||||
|
|
|
@ -30,6 +30,28 @@ func (repo *pgRepository) Fetch(ctx context.Context, server string, f *models.Vi
|
|||
Limit(f.Limit).
|
||||
Offset(f.Offset)
|
||||
|
||||
if f.XGTE != 0 {
|
||||
query = query.Where("x >= ?", f.XGTE)
|
||||
} else if f.XGT != 0 {
|
||||
query = query.Where("x > ?", f.XGT)
|
||||
}
|
||||
if f.XLTE != 0 {
|
||||
query = query.Where("x <= ?", f.XLTE)
|
||||
} else if f.XLT != 0 {
|
||||
query = query.Where("x < ?", f.XLT)
|
||||
}
|
||||
|
||||
if f.YGTE != 0 {
|
||||
query = query.Where("y >= ?", f.YGTE)
|
||||
} else if f.YGT != 0 {
|
||||
query = query.Where("y > ?", f.YGT)
|
||||
}
|
||||
if f.YLTE != 0 {
|
||||
query = query.Where("y <= ?", f.YLTE)
|
||||
} else if f.YLT != 0 {
|
||||
query = query.Where("y < ?", f.YLT)
|
||||
}
|
||||
|
||||
if f.Sort != "" {
|
||||
query = query.Order(f.Sort)
|
||||
}
|
||||
|
|
Reference in New Issue
Block a user