36 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Package abstract ...
 | |
| //
 | |
| // Description : abstract ...
 | |
| //
 | |
| // Author : go_developer@163.com<白茶清欢>
 | |
| //
 | |
| // Date : 2024-08-20 17:26
 | |
| package abstract
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 	"git.zhangdeman.cn/zhangdeman/database/define"
 | |
| 	"go.uber.org/zap"
 | |
| 	"gorm.io/gorm"
 | |
| )
 | |
| 
 | |
| // IWrapperClient 包装的客户端, 包装 IWrapperDatabaseClient
 | |
| //
 | |
| // Author : go_developer@163.com<白茶清欢>
 | |
| //
 | |
| // Date : 17:26 2024/8/20
 | |
| type IWrapperClient interface {
 | |
| 	// AddWithConfigFile 通过配置文件增加数据库实例
 | |
| 	AddWithConfigFile(cfgFilePath string, logInstance *zap.Logger, extraFieldList []string) error
 | |
| 	// AddWithConfig 通过具体的配置增加数据库实例
 | |
| 	AddWithConfig(flag string, logInstance *zap.Logger, databaseConfig *define.Database, extraFieldList []string) error
 | |
| 	// BatchAddWithConfigDir 通过具体的配置列表增加数据库实例
 | |
| 	BatchAddWithConfigDir(cfgDir string, logInstance *zap.Logger, extraFieldList []string) error
 | |
| 	// GetDBClient 基于数据库标识获取数据库实例
 | |
| 	GetDBClient(dbFlag string) (IWrapperDatabaseClient, error)
 | |
| 	// GetMasterClient 获取主库连接
 | |
| 	GetMasterClient(ctx context.Context, dbFlag string) (*gorm.DB, error)
 | |
| 	// GetSlaveClient 获取从库连接
 | |
| 	GetSlaveClient(ctx context.Context, dbFlag string) (*gorm.DB, error)
 | |
| }
 |