Skip to content

Instantly share code, notes, and snippets.

@kben19
Created April 2, 2022 11:40
Show Gist options
  • Save kben19/561b5fee2a3b61d63e5408193107895b to your computer and use it in GitHub Desktop.
Save kben19/561b5fee2a3b61d63e5408193107895b to your computer and use it in GitHub Desktop.
Wrapper Versioning
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