Skip to content

Commit

Permalink
docs: document DRY in code
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Adler <[email protected]>
  • Loading branch information
michaeladler committed Oct 16, 2023
1 parent 6a1c2ed commit 309a4bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/northbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ func NewNorthboundAPI(storage persistence.Storage) *operations.WorkflowExecutorA
}

func parseFilterParamsNorth(params northbound.GetJobsEventsParams) events.FilterParams {
// same code as parseFilterParamsSouth but params is from a different package;
// this isn't pretty (DRY) but we have a conceptually clear distinction
var filter events.FilterParams
if ids := params.JobIds; ids != nil {
filter.JobIDs = strings.Split(*ids, ",")
Expand Down
2 changes: 2 additions & 0 deletions api/southbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ func NewSouthboundAPI(storage persistence.Storage) *operations.WorkflowExecutorA
}

func parseFilterParamsSouth(params southbound.GetJobsEventsParams) events.FilterParams {
// same code as parseFilterParamsNorth but params is from a different package;
// this isn't pretty (DRY) but we have a conceptually clear distinction
var filter events.FilterParams
if ids := params.JobIds; ids != nil {
filter.JobIDs = strings.Split(*ids, ",")
Expand Down

0 comments on commit 309a4bc

Please sign in to comment.