Skip to content

Commit 26f9caf

Browse files
authored
Rename Db field to DB (temporalio#8281)
## What changed? Rename Db struct field to DB. ## Why? Linter forced me to on another PR; breaking this out into this one. ## How did you test it? - [x] built - [ ] run locally and tested manually - [ ] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s)
1 parent 758287a commit 26f9caf

File tree

17 files changed

+109
-109
lines changed

17 files changed

+109
-109
lines changed

common/persistence/sql/cluster_metadata.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func (s *sqlClusterMetadataManager) ListClusterMetadata(
3030
}
3131
}
3232

33-
rows, err := s.Db.ListClusterMetadata(ctx, &sqlplugin.ClusterMetadataFilter{ClusterName: clusterName, PageSize: &request.PageSize})
33+
rows, err := s.DB.ListClusterMetadata(ctx, &sqlplugin.ClusterMetadataFilter{ClusterName: clusterName, PageSize: &request.PageSize})
3434
if err != nil {
3535
if err == sql.ErrNoRows {
3636
return &p.InternalListClusterMetadataResponse{}, nil
@@ -65,7 +65,7 @@ func (s *sqlClusterMetadataManager) GetClusterMetadata(
6565
ctx context.Context,
6666
request *p.InternalGetClusterMetadataRequest,
6767
) (*p.InternalGetClusterMetadataResponse, error) {
68-
row, err := s.Db.GetClusterMetadata(ctx, &sqlplugin.ClusterMetadataFilter{ClusterName: request.ClusterName})
68+
row, err := s.DB.GetClusterMetadata(ctx, &sqlplugin.ClusterMetadataFilter{ClusterName: request.ClusterName})
6969

7070
if err != nil {
7171
return nil, convertCommonErrors("GetClusterMetadata", err)
@@ -119,7 +119,7 @@ func (s *sqlClusterMetadataManager) DeleteClusterMetadata(
119119
ctx context.Context,
120120
request *p.InternalDeleteClusterMetadataRequest,
121121
) error {
122-
_, err := s.Db.DeleteClusterMetadata(ctx, &sqlplugin.ClusterMetadataFilter{ClusterName: request.ClusterName})
122+
_, err := s.DB.DeleteClusterMetadata(ctx, &sqlplugin.ClusterMetadataFilter{ClusterName: request.ClusterName})
123123

124124
if err != nil {
125125
return convertCommonErrors("DeleteClusterMetadata", err)
@@ -159,7 +159,7 @@ func (s *sqlClusterMetadataManager) GetClusterMembers(
159159
filter.RPCAddressEquals = request.RPCAddressEquals.String()
160160
}
161161

162-
rows, err := s.Db.GetClusterMembers(ctx, filter)
162+
rows, err := s.DB.GetClusterMembers(ctx, filter)
163163

164164
if err != nil {
165165
return nil, convertCommonErrors("GetClusterMembers", err)
@@ -193,7 +193,7 @@ func (s *sqlClusterMetadataManager) UpsertClusterMembership(
193193
) error {
194194
now := time.Now().UTC()
195195
recordExpiry := now.Add(request.RecordExpiry)
196-
_, err := s.Db.UpsertClusterMembership(ctx, &sqlplugin.ClusterMembershipRow{
196+
_, err := s.DB.UpsertClusterMembership(ctx, &sqlplugin.ClusterMembershipRow{
197197
Role: request.Role,
198198
HostID: request.HostID,
199199
RPCAddress: request.RPCAddress.String(),
@@ -213,7 +213,7 @@ func (s *sqlClusterMetadataManager) PruneClusterMembership(
213213
ctx context.Context,
214214
request *p.PruneClusterMembershipRequest,
215215
) error {
216-
_, err := s.Db.PruneClusterMembership(
216+
_, err := s.DB.PruneClusterMembership(
217217
ctx,
218218
&sqlplugin.PruneClusterMembershipFilter{
219219
PruneRecordsBefore: time.Now().UTC(),

common/persistence/sql/common.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,36 @@ import (
1818

1919
// TODO: Rename all SQL Managers to Stores
2020
type SqlStore struct {
21-
Db sqlplugin.DB
21+
DB sqlplugin.DB
2222
logger log.Logger
2323
}
2424

2525
func NewSqlStore(db sqlplugin.DB, logger log.Logger) SqlStore {
2626
return SqlStore{
27-
Db: db,
27+
DB: db,
2828
logger: logger,
2929
}
3030
}
3131

3232
func (m *SqlStore) GetName() string {
33-
return m.Db.PluginName()
33+
return m.DB.PluginName()
3434
}
3535

3636
func (m *SqlStore) GetDbName() string {
37-
return m.Db.DbName()
37+
return m.DB.DbName()
3838
}
3939

4040
func (m *SqlStore) Close() {
41-
if m.Db != nil {
42-
err := m.Db.Close()
41+
if m.DB != nil {
42+
err := m.DB.Close()
4343
if err != nil {
4444
m.logger.Error("Error closing SQL database", tag.Error(err))
4545
}
4646
}
4747
}
4848

4949
func (m *SqlStore) txExecute(ctx context.Context, operation string, f func(tx sqlplugin.Tx) error) error {
50-
tx, err := m.Db.BeginTx(ctx)
50+
tx, err := m.DB.BeginTx(ctx)
5151
if err != nil {
5252
return serviceerror.NewUnavailablef("%s failed. Failed to start transaction. Error: %v", operation, err)
5353
}

common/persistence/sql/execution.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func (m *sqlExecutionStore) GetWorkflowExecution(
209209
namespaceID := primitives.MustParseUUID(request.NamespaceID)
210210
workflowID := request.WorkflowID
211211
runID := primitives.MustParseUUID(request.RunID)
212-
executionsRow, err := m.Db.SelectFromExecutions(ctx, sqlplugin.ExecutionsFilter{
212+
executionsRow, err := m.DB.SelectFromExecutions(ctx, sqlplugin.ExecutionsFilter{
213213
ShardID: request.ShardID,
214214
NamespaceID: namespaceID,
215215
WorkflowID: workflowID,
@@ -233,7 +233,7 @@ func (m *sqlExecutionStore) GetWorkflowExecution(
233233
}
234234

235235
state.ActivityInfos, err = getActivityInfoMap(ctx,
236-
m.Db,
236+
m.DB,
237237
request.ShardID,
238238
namespaceID,
239239
workflowID,
@@ -244,7 +244,7 @@ func (m *sqlExecutionStore) GetWorkflowExecution(
244244
}
245245

246246
state.TimerInfos, err = getTimerInfoMap(ctx,
247-
m.Db,
247+
m.DB,
248248
request.ShardID,
249249
namespaceID,
250250
workflowID,
@@ -255,7 +255,7 @@ func (m *sqlExecutionStore) GetWorkflowExecution(
255255
}
256256

257257
state.ChildExecutionInfos, err = getChildExecutionInfoMap(ctx,
258-
m.Db,
258+
m.DB,
259259
request.ShardID,
260260
namespaceID,
261261
workflowID,
@@ -266,7 +266,7 @@ func (m *sqlExecutionStore) GetWorkflowExecution(
266266
}
267267

268268
state.RequestCancelInfos, err = getRequestCancelInfoMap(ctx,
269-
m.Db,
269+
m.DB,
270270
request.ShardID,
271271
namespaceID,
272272
workflowID,
@@ -277,7 +277,7 @@ func (m *sqlExecutionStore) GetWorkflowExecution(
277277
}
278278

279279
state.SignalInfos, err = getSignalInfoMap(ctx,
280-
m.Db,
280+
m.DB,
281281
request.ShardID,
282282
namespaceID,
283283
workflowID,
@@ -288,7 +288,7 @@ func (m *sqlExecutionStore) GetWorkflowExecution(
288288
}
289289

290290
state.BufferedEvents, err = getBufferedEvents(ctx,
291-
m.Db,
291+
m.DB,
292292
request.ShardID,
293293
namespaceID,
294294
workflowID,
@@ -299,7 +299,7 @@ func (m *sqlExecutionStore) GetWorkflowExecution(
299299
}
300300

301301
state.ChasmNodes, err = getChasmNodeMap(ctx,
302-
m.Db,
302+
m.DB,
303303
request.ShardID,
304304
namespaceID,
305305
workflowID,
@@ -310,7 +310,7 @@ func (m *sqlExecutionStore) GetWorkflowExecution(
310310
}
311311

312312
state.SignalRequestedIDs, err = getSignalsRequested(ctx,
313-
m.Db,
313+
m.DB,
314314
request.ShardID,
315315
namespaceID,
316316
workflowID,
@@ -657,7 +657,7 @@ func (m *sqlExecutionStore) DeleteCurrentWorkflowExecution(
657657
) error {
658658
namespaceID := primitives.MustParseUUID(request.NamespaceID)
659659
runID := primitives.MustParseUUID(request.RunID)
660-
_, err := m.Db.DeleteFromCurrentExecutions(ctx, sqlplugin.CurrentExecutionsFilter{
660+
_, err := m.DB.DeleteFromCurrentExecutions(ctx, sqlplugin.CurrentExecutionsFilter{
661661
ShardID: request.ShardID,
662662
NamespaceID: namespaceID,
663663
WorkflowID: request.WorkflowID,
@@ -670,7 +670,7 @@ func (m *sqlExecutionStore) GetCurrentExecution(
670670
ctx context.Context,
671671
request *p.GetCurrentExecutionRequest,
672672
) (*p.InternalGetCurrentExecutionResponse, error) {
673-
row, err := m.Db.SelectFromCurrentExecutions(ctx, sqlplugin.CurrentExecutionsFilter{
673+
row, err := m.DB.SelectFromCurrentExecutions(ctx, sqlplugin.CurrentExecutionsFilter{
674674
ShardID: request.ShardID,
675675
NamespaceID: primitives.MustParseUUID(request.NamespaceID),
676676
WorkflowID: request.WorkflowID,

0 commit comments

Comments
 (0)