Skip to content

Instantly share code, notes, and snippets.

@andres-t
andres-t / README.md
Created August 20, 2019 05:07 — forked from benbjohnson/README.md
Application-side Interfaces in Go

Application-side Interfaces in Go

By moving the interface to the application-side (application.go), you can still set the implementation-specific configuration details when you instantiate your library structs. If the interface was implemented on the library-side then you would need to provide:

type DB interface {
  Get([]byte) ([]byte, error)
  Put([]byte, []byte) error
  CacheSize() int
 SetCacheSize(int)