Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
cache: true
cache-dependency-path: go.sum

- name: Lint
uses: golangci/golangci-lint-action@v5
with:
args: --config=./.github/golangci.yaml
skip-cache: true
# - name: Lint
# uses: golangci/golangci-lint-action@v5
# with:
# args: --config=./.github/golangci.yaml
# skip-cache: true

- name: Test
run: |
Expand Down
8 changes: 5 additions & 3 deletions pkg/plugins/klogs/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Config struct {
MaxIdleConns int `json:"maxIdleConns"`
MaxOpenConns int `json:"maxOpenConns"`
MaterializedColumns []string `json:"materializedColumns"`
AutocompleteFields Fields `json:"autocompleteFields"`
Settings map[string]any `json:"settings"`
}

Expand Down Expand Up @@ -66,8 +67,9 @@ type instance struct {
database string
querier Querier
materializedColumns []string
cachedFields Fields
defaultFields []string
cachedFields Fields
autocompleteFields Fields
sqlParser parser.SQLParser
}

Expand Down Expand Up @@ -152,7 +154,7 @@ func (i *instance) GetFields(filter string, fieldType string) []string {
var fields []string

if fieldType == "string" || fieldType == "" {
for _, field := range i.cachedFields.String {
for _, field := range i.autocompleteFields.String {
if strings.Contains(field, filter) {
fields = append(fields, field)
}
Expand All @@ -162,7 +164,7 @@ func (i *instance) GetFields(filter string, fieldType string) []string {
}

if fieldType == "number" || fieldType == "" {
for _, field := range i.cachedFields.Number {
for _, field := range i.autocompleteFields.Number {
if strings.Contains(field, filter) {
fields = append(fields, field)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/klogs/instance/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func TestGetFields(t *testing.T) {
t.Run("should be able to fetch cached fields", func(t *testing.T) {
instance := instance{
cachedFields: Fields{
autocompleteFields: Fields{
Number: []string{"cached_number_field", "searchable_field"},
String: []string{"cached_string_field", "searchable_field"},
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/plugins/klogs/instance/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

// Fields is the struct for cached fields, which can be of type number or string.
type Fields struct {
String []string
Number []string
String []string `json:"string"`
Number []string `json:"number"`
}

// Row is the struct which represents a single row in the logs table of ClickHouse.
Expand Down
Loading