Skip to content

Commit

Permalink
expose batch view tag
Browse files Browse the repository at this point in the history
  • Loading branch information
adranwit committed May 15, 2024
1 parent 7631b55 commit 78cbc9e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions repository/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ func WithContract(inputType, outputType reflect.Type, embedFs *embed.FS) Compone
if aView.Match != "" {
vOptions = append(vOptions, view.WithMatchStrategy(aView.Match))
}
if aView.BatchSize != 0 {
vOptions = append(vOptions, view.WithBatchSize(aView.BatchSize))
}
}

if aTag.SQL.SQL != "" {
Expand Down
11 changes: 11 additions & 0 deletions view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -1559,3 +1559,14 @@ func WithMatchStrategy(match string) Option {
return nil
}
}

// WithBatchSize creates an Option to set batchSize
func WithBatchSize(size int) Option {
return func(v *View) error {
if v.Batch == nil {
v.Batch = &Batch{}
}
v.Batch.Size = size
return nil
}
}

0 comments on commit 78cbc9e

Please sign in to comment.