Created
April 2, 2022 11:40
-
-
Save kben19/561b5fee2a3b61d63e5408193107895b to your computer and use it in GitHub Desktop.
Wrapper Versioning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (wrapper *ServiceWrapper) GetProductStock(id int) (int, error) { | |
// Get Version 2 | |
if id > 100 { | |
return wrapper.service.GetProductStockV2(id) | |
} | |
// Otherwise, use the old version | |
return wrapper.service.GetProductStock(id) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment