Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Created August 30, 2021 08:02
Show Gist options
  • Save percybolmer/72f1e84d4da41687062f7f03f91ceae4 to your computer and use it in GitHub Desktop.
Save percybolmer/72f1e84d4da41687062f7f03f91ceae4 to your computer and use it in GitHub Desktop.
func WithMongoCustomerRepository(connectionString string) OrderConfiguration {
return func(os *OrderService) error {
// Create the mongo repo, if we needed parameters, such as connection strings they could be inputted here
cr, err := mongo.New(context.Background(), connectionString)
if err != nil {
return err
}
os.customers = cr
return nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment