Skip to content

Commit 50bb587

Browse files
authored
Embed value instead of pointer in properties service ReadOptions (#4462)
This addresses previous feedback from Jakub Signed-off-by: Juan Antonio Osorio <[email protected]>
1 parent fd300ca commit 50bb587

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

internal/entities/properties/service/options.go

+5-8
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (psco *CallOptions) getStoreOrTransaction() db.ExtendQuerier {
5050
// This field is used to determine if the service call can return stale data or not.
5151
// This is useful for read calls that can tolerate stale data.
5252
type ReadOptions struct {
53-
*CallOptions
53+
CallOptions
5454
tolerateStaleData bool
5555
}
5656

@@ -68,15 +68,12 @@ func (psco *ReadOptions) TolerateStaleData() *ReadOptions {
6868
return psco
6969
}
7070

71-
// WithStoreOrTransaction is a function that sets the StoreOrTransaction field in the ReadOptions struct
71+
// WithStoreOrTransaction is a function that sets the StoreOrTransaction field in the CallOptions struct
7272
func (psco *ReadOptions) WithStoreOrTransaction(storeOrTransaction db.ExtendQuerier) *ReadOptions {
7373
if psco == nil {
7474
return nil
7575
}
76-
if psco.CallOptions == nil {
77-
psco.CallOptions = CallBuilder()
78-
}
79-
psco.CallOptions = psco.CallOptions.WithStoreOrTransaction(storeOrTransaction)
76+
psco.storeOrTransaction = storeOrTransaction
8077
return psco
8178
}
8279

@@ -88,7 +85,7 @@ func (psco *ReadOptions) canTolerateStaleData() bool {
8885
}
8986

9087
func (psco *ReadOptions) getStoreOrTransaction() db.ExtendQuerier {
91-
if psco == nil || psco.CallOptions == nil {
88+
if psco == nil {
9289
return nil
9390
}
9491
return psco.CallOptions.getStoreOrTransaction()
@@ -98,7 +95,7 @@ func (psco *ReadOptions) getPropertiesServiceCallOptions() *CallOptions {
9895
if psco == nil {
9996
return nil
10097
}
101-
return psco.CallOptions
98+
return &psco.CallOptions
10299
}
103100

104101
type getStoreOrTransaction interface {

0 commit comments

Comments
 (0)