package repositories import ( "time" "gitter.top/drivers/sdbc" "pastebin/config" genv1 "pastebin/gen/v1" ) 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(&genv1.ModelPastebin{}) } return pastebinOperator }