123456789101112131415161718192021222324252627282930313233343536 |
- package index
- import "eta/eta_bridge/global"
- // BinlogFormatStruct
- // @Description: 数据库的binlog格式
- type BinlogFormatStruct struct {
- VariableName string `json:"Variable_name"`
- Value string `json:"Value"`
- }
- // GetBinlogFormat
- // @Description: 获取数据库的binlog格式
- // @return item
- // @return err
- func GetBinlogFormat() (item *BinlogFormatStruct, err error) {
- sql := `SHOW VARIABLES LIKE 'binlog_format';`
- err = global.MYSQL["index"].Raw(sql).First(&item).Error
- return
- }
- type BinlogFileStruct struct {
- File string `json:"File"`
- Position uint32 `json:"Position"`
- }
- // GetShowMaster
- // @Description: 获取master的状态
- // @return item
- // @return err
- func GetShowMaster() (item *BinlogFileStruct, err error) {
- sql := `show master status;`
- err = global.MYSQL["index"].Raw(sql).First(&item).Error
- return
- }
|