package binlog import "github.com/beego/beego/v2/client/orm" // BinlogFormatStruct // @Description: 数据库的binlog格式 type BinlogFormatStruct struct { VariableName string `orm:"column(Variable_name)"` Value string `orm:"column(Value)"` } // GetBinlogFormat // @Description: 获取数据库的binlog格式 // @return item // @return err func GetBinlogFormat() (item *BinlogFormatStruct, err error) { o := orm.NewOrmUsingDB("data") sql := `SHOW VARIABLES LIKE 'binlog_format'` err = o.Raw(sql).QueryRow(&item) return } type BinlogFileStruct struct { File string `orm:"column(File)"` Position uint32 `orm:"column(Position)"` } // GetShowMaster // @Description: 获取master的状态 // @return item // @return err func GetShowMaster() (item *BinlogFileStruct, err error) { o := orm.NewOrmUsingDB("data") sql := `show master status` err = o.Raw(sql).QueryRow(&item) return }