mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-01 14:52:03 +08:00
parser updated
This commit is contained in:
parent
2132d1059c
commit
6ac7cb1022
@ -243,16 +243,32 @@ func GenerateSQLWhere(allFields *model.GetFieldsResponse, params *model.LogsFilt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if params.TimestampStart != nil {
|
if params.TimestampStart != nil {
|
||||||
tokens = append(tokens, fmt.Sprintf("and timestamp >= '%d' ", *params.TimestampStart))
|
filter := fmt.Sprintf("timestamp >= '%d' ", *params.TimestampStart)
|
||||||
|
if len(tokens) > 0 {
|
||||||
|
filter = "and " + filter
|
||||||
|
}
|
||||||
|
tokens = append(tokens, filter)
|
||||||
}
|
}
|
||||||
if params.TimestampEnd != nil {
|
if params.TimestampEnd != nil {
|
||||||
tokens = append(tokens, fmt.Sprintf("and timestamp <= '%d' ", *params.TimestampEnd))
|
filter := fmt.Sprintf("timestamp <= '%d' ", *params.TimestampEnd)
|
||||||
|
if len(tokens) > 0 {
|
||||||
|
filter = "and " + filter
|
||||||
|
}
|
||||||
|
tokens = append(tokens, filter)
|
||||||
}
|
}
|
||||||
if params.IdStart != nil {
|
if params.IdStart != nil {
|
||||||
tokens = append(tokens, fmt.Sprintf("and id > '%v' ", *params.IdStart))
|
filter := fmt.Sprintf("id > '%v' ", *params.IdStart)
|
||||||
|
if len(tokens) > 0 {
|
||||||
|
filter = "and " + filter
|
||||||
|
}
|
||||||
|
tokens = append(tokens, filter)
|
||||||
}
|
}
|
||||||
if params.IdEnd != nil {
|
if params.IdEnd != nil {
|
||||||
tokens = append(tokens, fmt.Sprintf("and id < '%v' ", *params.IdEnd))
|
filter := fmt.Sprintf("id < '%v' ", *params.IdEnd)
|
||||||
|
if len(tokens) > 0 {
|
||||||
|
filter = "and " + filter
|
||||||
|
}
|
||||||
|
tokens = append(tokens, filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlWhere := strings.Join(tokens, "")
|
sqlWhere := strings.Join(tokens, "")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user