package repositories import ( "gitter.top/drivers/sdbc" "pastebin/config" modelv1 "pastebin/model/v1" "time" ) var ( driver *sdbc.Driver pastebinOperator sdbc.Operator ) func GetPastebin() sdbc.Operator { if driver == nil { cfg := config.Get() driver = sdbc.NewSDBC(&sdbc.Config{ Dbname: cfg.DBConfig.Dbname, MaxIdleConn: 20, MaxOpenConn: 200, MaxLifetime: time.Hour, Debug: cfg.DBConfig.Debug, }) } if pastebinOperator == nil { pastebinOperator = driver.BindModel(&modelv1.ModelPastebin{}) } return pastebinOperator }