Skip to content
This repository was archived by the owner on Sep 7, 2021. It is now read-only.

Commit f7111a8

Browse files
author
Florentin DUBOIS
authored
Merge pull request #81 from ovh/fix/filterbylabels
fix(filterbylabels): fix filterbylabels when using an ident in query
2 parents ceb68c6 + 32a8815 commit f7111a8

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

tsl/genericParser.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,13 @@ loop:
300300
p.Unscan()
301301

302302
instruction, err = p.parsePostVariables(pos, lit, instruction.connectStatement, false, loadVariable)
303+
304+
// resets select frameworks pointer
305+
frameworks := make([]FrameworkStatement, 0)
306+
for _, item := range instruction.selectStatement.frameworks {
307+
frameworks = append(frameworks, item)
308+
}
309+
instruction.selectStatement.frameworks = frameworks
303310
if err != nil {
304311
return nil, nil, err
305312
}

tsl/statements.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ func (from FromStatement) String() string {
293293

294294
func (framework FrameworkStatement) String() string {
295295
attributes := AttributesToString(framework.attributes)
296-
return " FrameworkStatement{ op: " + framework.operator.String() + "; attributes: " + attributes + "}"
296+
unknown := UnknownAttributesToString(framework.unNamedAttributes)
297+
return " FrameworkStatement{ op: " + framework.operator.String() + "; attributes: " + attributes + "; unknown" + unknown + "}"
297298
}
298299

299300
func (field InternalField) String() string {
@@ -318,3 +319,13 @@ func AttributesToString(attributes map[PrefixAttributes]InternalField) string {
318319

319320
return buffer.String()
320321
}
322+
323+
// UnknownAttributesToString transform an UnkonwAttributes map into string
324+
func UnknownAttributesToString(attributes map[int]InternalField) string {
325+
attrs := make([]string, len(attributes))
326+
i := 0
327+
for k, v := range attributes {
328+
attrs[i] = fmt.Sprintf("%d:%s", k, v)
329+
}
330+
return fmt.Sprintf("{%s}", strings.Join(attrs, ", "))
331+
}

0 commit comments

Comments
 (0)