代码拉取完成,页面将自动刷新
package gobatch
import (
"database/sql"
"github.com/chararch/gobatch/internal/logs"
"os"
)
//log
var logger logs.Logger = logs.NewLogger(os.Stdout, logs.Info)
//SetLogger set a logger instance for GoBatch
func SetLogger(l logs.Logger) {
logger = l
}
//task pool
const (
DefaultJobPoolSize = 10
DefaultStepTaskPoolSize = 1000
)
var jobPool = newTaskPool(DefaultJobPoolSize)
var stepPool = newTaskPool(DefaultStepTaskPoolSize)
//SetMaxRunningJobs set max number of parallel jobs for GoBatch
func SetMaxRunningJobs(size int) {
jobPool.SetMaxSize(size)
}
//SetMaxRunningSteps set max number of parallel steps for GoBatch
func SetMaxRunningSteps(size int) {
stepPool.SetMaxSize(size)
}
//db
var db *sql.DB
//SetDB register a *sql.DB instance for GoBatch
func SetDB(sqlDb *sql.DB) {
if sqlDb == nil {
panic("sqlDb must not be nil")
}
db = sqlDb
if txManager == nil {
txManager = &DefaultTxManager{sqlDb}
}
}
//transaction manager
var txManager TransactionManager
//SetTransactionManager register a TransactionManager instance for GoBatch
func SetTransactionManager(txMgr TransactionManager) {
if txMgr == nil {
panic("transaction manager must not be nil")
}
txManager = txMgr
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。