| 1234567891011121314151617181920212223242526272829303132333435 |
- package binding
- import (
- "git.sxidc.com/go-framework/baize/api"
- "git.sxidc.com/go-framework/baize/infrastructure"
- "git.sxidc.com/go-framework/baize/infrastructure/database"
- )
- type Binder struct {
- router api.Router
- i *infrastructure.Infrastructure
- }
- func NewBinder(router api.Router, i *infrastructure.Infrastructure) *Binder {
- return &Binder{
- router: router,
- i: i,
- }
- }
- const (
- DBExecutorOperations = "operations"
- DBExecutorDataService = "data_service"
- )
- func (binder *Binder) ChooseDBExecutor(dataExecutorType string) database.Executor {
- switch dataExecutorType {
- case DBExecutorOperations:
- return binder.i.DBOperations()
- case DBExecutorDataService:
- return binder.i.DataService()
- default:
- return binder.i.DBOperations()
- }
- }
|