Quiz: Transactional Messaging
Test yourself on what you have learned so far.
1
What does the Scoped()
method return in the provided code snippet?
container := di.New()
container.AddSingleton("db", dbFn)
container.AddScoped("tx", txFn)
db1 := container.Get("db")
tx1 := container.Get("tx")
ctx := container.Scoped(context.Background())
A)
A container instance
B)
A context with the container value
C)
A new instance of the dependency
D)
A child container
Question 1 of 50 attempted
Get hands-on with 1200+ tech skills courses.