From 2a4cd70bbd8f4fe32115099167e5b44cf44755f6 Mon Sep 17 00:00:00 2001 From: Artur Sawicki Date: Tue, 23 Jan 2024 14:48:06 +0100 Subject: [PATCH] Fix linter complaints --- pkg/sdk/materialized_views_impl_gen.go | 34 +++++-------------- ...materialized_views_gen_integration_test.go | 6 ++-- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/pkg/sdk/materialized_views_impl_gen.go b/pkg/sdk/materialized_views_impl_gen.go index 98d386c6a17..1914973bf3a 100644 --- a/pkg/sdk/materialized_views_impl_gen.go +++ b/pkg/sdk/materialized_views_impl_gen.go @@ -64,32 +64,21 @@ func (r *CreateMaterializedViewRequest) toOpts() *CreateMaterializedViewOptions IfNotExists: r.IfNotExists, name: r.name, CopyGrants: r.CopyGrants, - - Comment: r.Comment, - - Tag: r.Tag, - - sql: r.sql, + Comment: r.Comment, + Tag: r.Tag, + sql: r.sql, } if r.Columns != nil { s := make([]MaterializedViewColumn, len(r.Columns)) for i, v := range r.Columns { - s[i] = MaterializedViewColumn{ - Name: v.Name, - Comment: v.Comment, - } + s[i] = MaterializedViewColumn(v) } opts.Columns = s } if r.ColumnsMaskingPolicies != nil { s := make([]MaterializedViewColumnMaskingPolicy, len(r.ColumnsMaskingPolicies)) for i, v := range r.ColumnsMaskingPolicies { - s[i] = MaterializedViewColumnMaskingPolicy{ - Name: v.Name, - MaskingPolicy: v.MaskingPolicy, - Using: v.Using, - Tag: v.Tag, - } + s[i] = MaterializedViewColumnMaskingPolicy(v) } opts.ColumnsMaskingPolicies = s } @@ -104,9 +93,7 @@ func (r *CreateMaterializedViewRequest) toOpts() *CreateMaterializedViewOptions if r.ClusterBy.Expressions != nil { s := make([]MaterializedViewClusterByExpression, len(r.ClusterBy.Expressions)) for i, v := range r.ClusterBy.Expressions { - s[i] = MaterializedViewClusterByExpression{ - Name: v.Name, - } + s[i] = MaterializedViewClusterByExpression(v) } opts.ClusterBy.Expressions = s } @@ -116,9 +103,8 @@ func (r *CreateMaterializedViewRequest) toOpts() *CreateMaterializedViewOptions func (r *AlterMaterializedViewRequest) toOpts() *AlterMaterializedViewOptions { opts := &AlterMaterializedViewOptions{ - name: r.name, - RenameTo: r.RenameTo, - + name: r.name, + RenameTo: r.RenameTo, DropClusteringKey: r.DropClusteringKey, SuspendRecluster: r.SuspendRecluster, ResumeRecluster: r.ResumeRecluster, @@ -130,9 +116,7 @@ func (r *AlterMaterializedViewRequest) toOpts() *AlterMaterializedViewOptions { if r.ClusterBy.Expressions != nil { s := make([]MaterializedViewClusterByExpression, len(r.ClusterBy.Expressions)) for i, v := range r.ClusterBy.Expressions { - s[i] = MaterializedViewClusterByExpression{ - Name: v.Name, - } + s[i] = MaterializedViewClusterByExpression(v) } opts.ClusterBy.Expressions = s } diff --git a/pkg/sdk/testint/materialized_views_gen_integration_test.go b/pkg/sdk/testint/materialized_views_gen_integration_test.go index f076e19bc38..09f162879de 100644 --- a/pkg/sdk/testint/materialized_views_gen_integration_test.go +++ b/pkg/sdk/testint/materialized_views_gen_integration_test.go @@ -131,7 +131,7 @@ func TestInt_MaterializedViews(t *testing.T) { Name: tag.ID(), Value: "v2", }}). - WithClusterBy(sdk.NewMaterializedViewClusterByRequest().WithExpressions([]sdk.MaterializedViewClusterByExpressionRequest{{"COLUMN_WITH_COMMENT"}})) + WithClusterBy(sdk.NewMaterializedViewClusterByRequest().WithExpressions([]sdk.MaterializedViewClusterByExpressionRequest{{Name: "COLUMN_WITH_COMMENT"}})) id := request.GetName() @@ -200,7 +200,7 @@ func TestInt_MaterializedViews(t *testing.T) { view := createMaterializedView(t) id := view.ID() - alterRequest := sdk.NewAlterMaterializedViewRequest(id).WithClusterBy(sdk.NewMaterializedViewClusterByRequest().WithExpressions([]sdk.MaterializedViewClusterByExpressionRequest{{"ID"}})) + alterRequest := sdk.NewAlterMaterializedViewRequest(id).WithClusterBy(sdk.NewMaterializedViewClusterByRequest().WithExpressions([]sdk.MaterializedViewClusterByExpressionRequest{{Name: "ID"}})) err := client.MaterializedViews.Alter(ctx, alterRequest) require.NoError(t, err) @@ -211,7 +211,7 @@ func TestInt_MaterializedViews(t *testing.T) { }) t.Run("alter materialized view: recluster suspend and resume", func(t *testing.T) { - request := createMaterializedViewBasicRequest(t).WithClusterBy(sdk.NewMaterializedViewClusterByRequest().WithExpressions([]sdk.MaterializedViewClusterByExpressionRequest{{"ID"}})) + request := createMaterializedViewBasicRequest(t).WithClusterBy(sdk.NewMaterializedViewClusterByRequest().WithExpressions([]sdk.MaterializedViewClusterByExpressionRequest{{Name: "ID"}})) view := createMaterializedViewWithRequest(t, request) id := view.ID()