Practical Explanation of Golang INTERFACES
HTML-код
- Опубликовано: 16 окт 2024
- In this video I'll give you a practical explanation with real-world examples of how to use interfaces in Go, so you can become a better engineer and make your code more modular and testable.
✅ Check the "Complete Backend API in Golang" Course: • Complete Backend API i...
👉 Join the private community to level up as software engineer: selfmadeengine...
📢 We're building a Discord community, come and join
/ discord
x.com/tiago_ta...
📚 Resources
Effective Go: go.dev/doc/eff...
Jordan Orelli Blog post: jordanorelli.c...
Hope you liked and thanks for watching!
#golang #api #go
Bro you are making killer content on golang, i am just binge watching these amazing tutorials and also following along. Videos like these are so damnn helpful to juniors like us. Keep it up ! and all the best. 🫶
Thank you so much! I'm glad you're liking them! 💪 more are comming
@@TiagoTaquelim waiting for epicness !
Awesome explanation Tiago.
Great content, thanks Tiago!
I agree. Your content is amazing!!
Thanks 💪
Bro, thaaaank you!
Amazing video, a bit fast but after coding along I got it, thanks
This is Epic! Grand Merci! When I was watching your "How to build ecom API" video, I was thinking "why the hell is he using interfaces here". This is a very good explanation, if not implementation, but purpose is very clear. Videos should be well integrated with each other, guiding us "noob users" to explanations!
Thannk you so much! I Agree!
Great video once again
Amazing content!
im failing to see how any of these interface videos are really that different. it mostly consist of a dev who knows how to use them, flying through code (at least this is a realistic example with some testing) and i dont know ---- feels like these things are just popped out. probably best to just code yourself and get a feel for it
Oh not the pigeon lmao
🤣
In a recipe rest API I recently created created with go(obviously), since I needed to make Multiple insertions in multiple tables, I used a transaction.
But...
I realized in instead of passing a pointer to sql.db e.g
func (ri *RecipeInstruction) Insert(recipe Recipe, tx *sql.Tx) error {}
i also wanted to do
func (ri *RecipeInstruction) Insert(recipe Recipe, tx *sql.BD) error {}
but I could not find a built in interface that can satisfy both a transaction and a DB.
Must i create my own? or is this not a proper implementation of interfaces.
You could either make the transaction just into a function, everything inside it, then you would not need to pass it around.
Or you could implement something like this: dev.to/techschoolguru/a-clean-way-to-implement-database-transaction-in-golang-2ba