How to create singleton DB class in GoLang
EDITED Solved :How should i create singleton DBManager class in GoLang. I Referred few code sample of how to create go singleton but i wish to have methods in those and call them on their singleton reference. My Code is as follows package dbprovider import ( "github.com/jinzhu/gorm" _"github.com/jinzhu/gorm/dialects/sqlite" "rest/article" "log" ) type DBOperations interface { AddArticle(article *article.Article) } type DBManager struct { db *gorm.DB isInitialized bool } var dbManagerInstance = new() func GetDBManager() DBManager { return dbManagerInstance } func new() DBManager { localDbRef,