Skip to content

Instantly share code, notes, and snippets.

@arriqaaq
Created January 27, 2023 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arriqaaq/da367a8878e827d3810dc62b3c64e207 to your computer and use it in GitHub Desktop.
Save arriqaaq/da367a8878e827d3810dc62b3c64e207 to your computer and use it in GitHub Desktop.
type Database interface {
Insert(data interface{}) error
Retrieve(id string) (interface{}, error)
}
type MySQL struct {
connection *sql.DB
}
func (m *MySQL) Insert(data interface{}) error {
// insert data into MySQL
}
func (m *MySQL) Retrieve(id string) (interface{}, error) {
// retrieve data from MySQL
}
type MongoDB struct {
session *mgo.Session
}
func (m *MongoDB) Insert(data interface{}) error {
// insert data into MongoDB
}
func (m *MongoDB) Retrieve(id string) (interface{}, error) {
// retrieve data from MongoDB
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment