双精度色彩检索
This commit is contained in:
@@ -857,13 +857,23 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
||||
return nil, err
|
||||
}
|
||||
fmt.Println(color, r, g, b, precision)
|
||||
query = query.Where(goqu.And(
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_r", index)).Gt(r-precision),
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_r", index)).Lt(r+precision),
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_g", index)).Gt(g-precision),
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_g", index)).Lt(g+precision),
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_b", index)).Gt(b-precision),
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_b", index)).Lt(b+precision),
|
||||
query = query.Where(goqu.Or(
|
||||
goqu.And(
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_r", 0)).Gt(r-precision),
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_r", 0)).Lt(r+precision),
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_g", 0)).Gt(g-precision),
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_g", 0)).Lt(g+precision),
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_b", 0)).Gt(b-precision),
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_b", 0)).Lt(b+precision),
|
||||
),
|
||||
goqu.And(
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_r", 1)).Gt(r-precision),
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_r", 1)).Lt(r+precision),
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_g", 1)).Gt(g-precision),
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_g", 1)).Lt(g+precision),
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_b", 1)).Gt(b-precision),
|
||||
goqu.L(fmt.Sprintf("web_images.color_%d_b", 1)).Lt(b+precision),
|
||||
),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user