diff --git a/repository/component.go b/repository/component.go index 18e080fc..2c21ab54 100644 --- a/repository/component.go +++ b/repository/component.go @@ -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 != "" { diff --git a/view/view.go b/view/view.go index 51e31e68..62708b3f 100644 --- a/view/view.go +++ b/view/view.go @@ -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 + } +}