Learning Golang: Interface Types – Part 1



Learning Golang: Interface Types – Part 1

Learning Golang: Interface Types - Part 1

Welcome! Let’s learn about Go Types, specifically Interface Types, a little bit of Functions and Methods; and why all of those types are somehow interconnected.

* What is an Interface in Go?

An interface type is defined as a set of method signatures, a value of interface type can hold any value that implements those methods.

* How to implement Interfaces in Go?

Compared to other programming languages, a type implements an interface IMPLICITLY by implementing the methods; there’s no need to refer to the original interface, there’s no concept of “extends” or “implements”. This means the actual concrete implementation of a type could appear in any other package without prearrangement.

In a future episode I will discuss more about interfaces and types in Go like:

* Empty interface “interface{}”,
* nil interfaces,
* Type assertions, and
* Type switches

* Golang Microservices: Repository Pattern, Dependency Injection and Services: https://youtu.be/Z89UU4vSayY

* int8 var value can not be assigned to Priority var value: https://play.golang.org/p/QVKVKIWp9ji
* Service Package Interface Types: https://github.com/MarioCarrion/todo-api-microservice-example/blob/28cc9a1224d5440424649c9ca9215b5da862a182/internal/service/task.go#L12-L37
* Binary Uses Concrete Types as Dependency Injection: https://github.com/MarioCarrion/todo-api-microservice-example/blob/28cc9a1224d5440424649c9ca9215b5da862a182/cmd/rest-server/main.go#L197-L211

* Playlist “Learning Golang”: https://www.youtube.com/playlist?list=PL7yAAGMOat_F7bOImcjx4ZnCtfyNEqzCy
* Playlist “Building Microservices in Go/Golang”: https://www.youtube.com/playlist?list=PL7yAAGMOat_Fn8sAXIk0WyBfK_sT1pohu
* Playlist “Golang Tools and Packages”: https://www.youtube.com/playlist?list=PL7yAAGMOat_HEEOvH99agDs_5g51A0Ls3
* Playlist “Testing in Go”: https://www.youtube.com/playlist?list=PL7yAAGMOat_HSeW4zF0uRL9EaHadE4ZZq

00:00 – Start
00:10 – Introduction: What is a Type (Basic/Composite) in Golang?
01:00 – Functions and Methods in Golang – Example
03:45 – What is an Interface Type?
06:66 – What about interface{}, type assertions?
07:10 – Conclusion

Who am I:

Hello👋🏼! I’m Mario, a Hands-on Software Architect and Lead Backend Engineer with more than 16 years of professional experience building all kinds of software including on-premise Industrial Automation Systems, Linux Accessibility Desktop and Browser Components as well as Distributed Advertising Microservices.

Every week I will share with you different topics I’ve learned while working for small startups and large companies including the processes I’ve followed over the years for successfully delivering complex enterprise systems from start to end.

Subscribe if you like Software Development, Software Architecture and Systems Design!

Keep it up. Don’t give up!

#golang #microservices #programming

— Our affiliate links below

Shop our Amazon favorites → https://www.amazon.com/shop/rubycarrion
Shop my IG feed on my LIKEtoKNOWit (LTK) page → https://www.liketoknow.it/RubyCarrion
Shop Top Deals and Featured Offers at Best Buy → https://bestbuy.7tiv.net/c/2558226/687081/10014
Get a 30 day FREE Trial of Epidemic Sound → https://www.epidemicsound.com/referral/szx441/
Try Amazon Prime 30-day FREE Trial → https://amzn.to/3yf9a0f
I love getting Cash Back and think you will too! Join for FREE and get $30 when you spend $30. https://www.rakuten.com/r/RUBYRA132?eeid=28187

— Our Vlog Channel

https://www.youtube.com/c/RubyCarrion/videos

Comments are closed.