MCPcopy Create free account
hub / github.com/PacktPublishing/Go-Design-Patterns / GetPaymentMethod

Function GetPaymentMethod

Chapter02/factory.go:24–33  ·  view source on GitHub ↗

CreatePaymentMethod returns a pointer to a PaymentMethod object or an error if the method is not registered. We used "new" operator to return the pointer but we could also used &Type{} althought new makes it more readable for newcomers could be confusing

(m int)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 3

TestGetPaymentMethodCashFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestGetPaymentMethodCashFunction · 0.68