Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for depguard and tagalign linters #326

Merged
merged 1 commit into from
Jun 2, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ linters:
enable-all: true
disable:
# Work on enabling this
- depguard
- nestif
- gocyclo
- gocognit
Expand Down
32 changes: 16 additions & 16 deletions schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func TestCollectionSchema(t *testing.T) {
Map map[string]string `json:"map_1"`
Slice2 []subStruct `json:"slice_2"`
Map2 map[string]subStruct `json:"map_2"`
Data2 subStructPK `json:"data_2" tigris:"-"` // should be skipped
Data2 subStructPK `json:"data_2" tigris:"-"` // should be skipped
MapAny map[string]any `json:"map_any"`

Bool123 bool `json:"bool_123"`
Expand Down Expand Up @@ -452,25 +452,25 @@ func TestTags(t *testing.T) {
Field1 string

FieldNestedIndexAndReq int `json:"field_nested_index_and_req" tigris:"required,index"`
FieldNestedIndex2 int `json:"field_nested_index2" tigris:"index"`
FieldNestedRequired int `json:"field_nested_required" tigris:"required"`
FieldNestedRequired2 int `json:"field_nested_required2" tigris:"required"`
FieldNestedIndex2 int `json:"field_nested_index2" tigris:"index"`
FieldNestedRequired int `json:"field_nested_required" tigris:"required"`
FieldNestedRequired2 int `json:"field_nested_required2" tigris:"required"`
}

type TestDefaults struct {
FieldIndexAndReq int `json:"field_index_and_req" tigris:"required,index"`
FieldIndex2 int `json:"field_index2" tigris:"index"`
FieldRequired int `json:"field_required" tigris:"required"`
FieldRequired2 int `json:"field_required2" tigris:"required"`
FieldMaxLength string `json:"field_max_length" tigris:"maxLength:123"`
FieldDefaultBool bool `json:"def_bool" tigris:"default:true"`
FieldDefaultInt int `json:"def_int" tigris:"default:789"`
FieldDefaultFloat float64 `json:"def_float" tigris:"default:456.34"`
FieldDefaultStr string `json:"def_str" tigris:"default:str1"`
FieldDefaultStr1 string `json:"def_str1" tigris:"default:'st\\'r2'"`
FieldDefaultArr []string `json:"def_arr_str" tigris:"default:'[\"one\", \"two\"]'"`
FieldDefaultObj struct1 `json:"def_obj_str" tigris:"default:'{\"Field1\":\"aaa\"}'"`
FieldSearchIndex string `json:"def_search_index" tigris:"searchIndex,sort,facet"`
FieldIndex2 int `json:"field_index2" tigris:"index"`
FieldRequired int `json:"field_required" tigris:"required"`
FieldRequired2 int `json:"field_required2" tigris:"required"`
FieldMaxLength string `json:"field_max_length" tigris:"maxLength:123"`
FieldDefaultBool bool `json:"def_bool" tigris:"default:true"`
FieldDefaultInt int `json:"def_int" tigris:"default:789"`
FieldDefaultFloat float64 `json:"def_float" tigris:"default:456.34"`
FieldDefaultStr string `json:"def_str" tigris:"default:str1"`
FieldDefaultStr1 string `json:"def_str1" tigris:"default:'st\\'r2'"`
FieldDefaultArr []string `json:"def_arr_str" tigris:"default:'[\"one\", \"two\"]'"`
FieldDefaultObj struct1 `json:"def_obj_str" tigris:"default:'{\"Field1\":\"aaa\"}'"`
FieldSearchIndex string `json:"def_search_index" tigris:"searchIndex,sort,facet"`

VectorField [5]float64 `json:"vector_field" tigris:"vector"`

Expand Down
2 changes: 1 addition & 1 deletion timeseries/timeseries.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var BufSize = 16
// Model is embeddable model with primary key for time-series collection.
type Model struct {
Timestamp time.Time `json:"timestamp" tigris:"primaryKey:1,autoGenerate"`
ID uuid.UUID `json:"id" tigris:"primaryKey:2,autoGenerate"`
ID uuid.UUID `json:"id" tigris:"primaryKey:2,autoGenerate"`
}

// Collection is buffered time-series collection.
Expand Down