mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
go fmt
This commit is contained in:
parent
09874f0d16
commit
939e4b57a8
|
@ -26,7 +26,7 @@ func QueryJson(jsonLine string, projections []string, query Query) (passedFilter
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func filterJson(jsonLine string, query Query) bool{
|
func filterJson(jsonLine string, query Query) bool {
|
||||||
|
|
||||||
value := gjson.Get(jsonLine, query.Field)
|
value := gjson.Get(jsonLine, query.Field)
|
||||||
|
|
||||||
|
|
|
@ -55,9 +55,9 @@ func TestGjson(t *testing.T) {
|
||||||
|
|
||||||
`
|
`
|
||||||
|
|
||||||
projections := []string{"quiz","fruit"}
|
projections := []string{"quiz", "fruit"}
|
||||||
|
|
||||||
gjson.ForEachLine(data, func(line gjson.Result) bool{
|
gjson.ForEachLine(data, func(line gjson.Result) bool {
|
||||||
println(line.Raw)
|
println(line.Raw)
|
||||||
println("+++++++++++")
|
println("+++++++++++")
|
||||||
results := gjson.GetMany(line.Raw, projections...)
|
results := gjson.GetMany(line.Raw, projections...)
|
||||||
|
@ -68,8 +68,6 @@ func TestGjson(t *testing.T) {
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJsonQueryRow(t *testing.T) {
|
func TestJsonQueryRow(t *testing.T) {
|
||||||
|
@ -133,4 +131,3 @@ func TestJsonQueryNumber(t *testing.T) {
|
||||||
println(string(buf))
|
println(string(buf))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,30 +73,29 @@ func IsTemporal(t Type) bool {
|
||||||
// Vitess data types. These are idiomatically
|
// Vitess data types. These are idiomatically
|
||||||
// named synonyms for the Type values.
|
// named synonyms for the Type values.
|
||||||
const (
|
const (
|
||||||
Null = Type_NULL_TYPE
|
Null = Type_NULL_TYPE
|
||||||
Int8 = Type_INT8
|
Int8 = Type_INT8
|
||||||
Uint8 = Type_UINT8
|
Uint8 = Type_UINT8
|
||||||
Int16 = Type_INT16
|
Int16 = Type_INT16
|
||||||
Uint16 = Type_UINT16
|
Uint16 = Type_UINT16
|
||||||
Int32 = Type_INT32
|
Int32 = Type_INT32
|
||||||
Uint32 = Type_UINT32
|
Uint32 = Type_UINT32
|
||||||
Int64 = Type_INT64
|
Int64 = Type_INT64
|
||||||
Uint64 = Type_UINT64
|
Uint64 = Type_UINT64
|
||||||
Float32 = Type_FLOAT32
|
Float32 = Type_FLOAT32
|
||||||
Float64 = Type_FLOAT64
|
Float64 = Type_FLOAT64
|
||||||
Timestamp = Type_TIMESTAMP
|
Timestamp = Type_TIMESTAMP
|
||||||
Date = Type_DATE
|
Date = Type_DATE
|
||||||
Time = Type_TIME
|
Time = Type_TIME
|
||||||
Datetime = Type_DATETIME
|
Datetime = Type_DATETIME
|
||||||
Year = Type_YEAR
|
Year = Type_YEAR
|
||||||
Decimal = Type_DECIMAL
|
Decimal = Type_DECIMAL
|
||||||
Text = Type_TEXT
|
Text = Type_TEXT
|
||||||
Blob = Type_BLOB
|
Blob = Type_BLOB
|
||||||
VarChar = Type_VARCHAR
|
VarChar = Type_VARCHAR
|
||||||
VarBinary = Type_VARBINARY
|
VarBinary = Type_VARBINARY
|
||||||
Char = Type_CHAR
|
Char = Type_CHAR
|
||||||
Binary = Type_BINARY
|
Binary = Type_BINARY
|
||||||
Bit = Type_BIT
|
Bit = Type_BIT
|
||||||
TypeJSON = Type_JSON
|
TypeJSON = Type_JSON
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ type Value struct {
|
||||||
val []byte
|
val []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// NewValue builds a Value using typ and val. If the value and typ
|
// NewValue builds a Value using typ and val. If the value and typ
|
||||||
// don't match, it returns an error.
|
// don't match, it returns an error.
|
||||||
func NewValue(typ Type, val []byte) (v Value, err error) {
|
func NewValue(typ Type, val []byte) (v Value, err error) {
|
||||||
|
@ -62,7 +61,6 @@ func MakeTrusted(typ Type, val []byte) Value {
|
||||||
return Value{typ: typ, val: val}
|
return Value{typ: typ, val: val}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// NewInt64 builds an Int64 Value.
|
// NewInt64 builds an Int64 Value.
|
||||||
func NewInt64(v int64) Value {
|
func NewInt64(v int64) Value {
|
||||||
return MakeTrusted(Int64, strconv.AppendInt(nil, v, 10))
|
return MakeTrusted(Int64, strconv.AppendInt(nil, v, 10))
|
||||||
|
|
|
@ -34,24 +34,22 @@ func (vs *VolumeServer) Query(req *volume_server_pb.QueryRequest, stream volume_
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.InputSerialization.CsvInput!=nil{
|
if req.InputSerialization.CsvInput != nil {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.InputSerialization.JsonInput!=nil{
|
if req.InputSerialization.JsonInput != nil {
|
||||||
|
|
||||||
stripe := &volume_server_pb.QueriedStripe{
|
stripe := &volume_server_pb.QueriedStripe{
|
||||||
Records:nil,
|
Records: nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
filter := json.Query{
|
filter := json.Query{
|
||||||
Field: req.Filter.Field,
|
Field: req.Filter.Field,
|
||||||
Op: req.Filter.Operand,
|
Op: req.Filter.Operand,
|
||||||
Value:req.Filter.Value,
|
Value: req.Filter.Value,
|
||||||
}
|
}
|
||||||
gjson.ForEachLine(string(n.Data), func(line gjson.Result) bool{
|
gjson.ForEachLine(string(n.Data), func(line gjson.Result) bool {
|
||||||
passedFilter, values := json.QueryJson(line.Raw, req.Selections, filter)
|
passedFilter, values := json.QueryJson(line.Raw, req.Selections, filter)
|
||||||
if !passedFilter {
|
if !passedFilter {
|
||||||
return true
|
return true
|
||||||
|
@ -68,4 +66,4 @@ func (vs *VolumeServer) Query(req *volume_server_pb.QueryRequest, stream volume_
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue