Skip to content

Commit

Permalink
Fix linter complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-asawicki committed Jan 23, 2024
1 parent 0437301 commit a1e3fba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 28 deletions.
34 changes: 9 additions & 25 deletions pkg/sdk/materialized_views_impl_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand All @@ -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,
Expand All @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/sdk/testint/materialized_views_gen_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)

Expand All @@ -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()

Expand Down

0 comments on commit a1e3fba

Please sign in to comment.