package
0.0.0-20241202101210-cf6782c561c0
Repository: https://github.com/lechuhuuha/go-leet-code.git
Documentation: pkg.go.dev

# README

adapter-mini-2x Adapter in Go

Adapter is a structural design pattern, which allows incompatible objects to collaborate.

The Adapter acts as a wrapper between two objects. It catches calls for one object and transforms them to format and interface recognizable by the second object.

Conceptual Example

We have a client code that expects some features of an object (Lightning port), but we have another object called adaptee (Windows laptop) which offers the same functionality but through a different interface (USB port)

This is where the Adapter pattern comes into the picture. We create a struct type known as adapter that will:

  • Adhere to the same interface which the client expects (Lightning port).
  • Translate the request from the client to the adaptee in the form that the adaptee expects.
  • The adapter accepts a Lightning connector and:
    • Translates its signals into a USB format.
    • Passes the signals to the USB port in a Windows laptop.