本文整理汇总了Golang中github.com/outbrain/orchestrator/go/inst.BinlogCoordinates类的典型用法代码示例。如果您正苦于以下问题:Golang BinlogCoordinates类的具体用法?Golang BinlogCoordinates怎么用?Golang BinlogCoordinates使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BinlogCoordinates类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestBinlogFileNumberDistance
func (s *TestSuite) TestBinlogFileNumberDistance(c *C) {
c1 := inst.BinlogCoordinates{LogFile: "mysql-bin.00017", LogPos: 104}
fileNum, numLen := c1.FileNumber()
c.Assert(fileNum, Equals, 17)
c.Assert(numLen, Equals, 5)
}
示例2: TestBinlogFileNumber
func (s *TestSuite) TestBinlogFileNumber(c *C) {
c1 := inst.BinlogCoordinates{LogFile: "mysql-bin.00017", LogPos: 104}
c2 := inst.BinlogCoordinates{LogFile: "mysql-bin.00022", LogPos: 104}
c.Assert(c1.FileNumberDistance(&c1), Equals, 0)
c.Assert(c1.FileNumberDistance(&c2), Equals, 5)
c.Assert(c2.FileNumberDistance(&c1), Equals, -5)
}
示例3: TestBinlogPrevious
func (s *TestSuite) TestBinlogPrevious(c *C) {
c1 := inst.BinlogCoordinates{LogFile: "mysql-bin.00017", LogPos: 104}
cres, err := c1.PreviousFileCoordinates()
c.Assert(err, IsNil)
c.Assert(c1.Type, Equals, cres.Type)
c.Assert(cres.LogFile, Equals, "mysql-bin.00016")
c2 := inst.BinlogCoordinates{LogFile: "mysql-bin.00100", LogPos: 104}
cres, err = c2.PreviousFileCoordinates()
c.Assert(err, IsNil)
c.Assert(c1.Type, Equals, cres.Type)
c.Assert(cres.LogFile, Equals, "mysql-bin.00099")
c3 := inst.BinlogCoordinates{LogFile: "mysql.00.prod.com.00100", LogPos: 104}
cres, err = c3.PreviousFileCoordinates()
c.Assert(err, IsNil)
c.Assert(c1.Type, Equals, cres.Type)
c.Assert(cres.LogFile, Equals, "mysql.00.prod.com.00099")
c4 := inst.BinlogCoordinates{LogFile: "mysql.00.prod.com.00000", LogPos: 104}
_, err = c4.PreviousFileCoordinates()
c.Assert(err, Not(IsNil))
}
示例4: TestBinlogCoordinates
func (s *TestSuite) TestBinlogCoordinates(c *C) {
c1 := inst.BinlogCoordinates{LogFile: "mysql-bin.00017", LogPos: 104}
c2 := inst.BinlogCoordinates{LogFile: "mysql-bin.00017", LogPos: 104}
c3 := inst.BinlogCoordinates{LogFile: "mysql-bin.00017", LogPos: 5000}
c4 := inst.BinlogCoordinates{LogFile: "mysql-bin.00112", LogPos: 104}
c.Assert(c1.Equals(&c2), Equals, true)
c.Assert(c1.Equals(&c3), Equals, false)
c.Assert(c1.Equals(&c4), Equals, false)
c.Assert(c1.SmallerThan(&c2), Equals, false)
c.Assert(c1.SmallerThan(&c3), Equals, true)
c.Assert(c1.SmallerThan(&c4), Equals, true)
c.Assert(c3.SmallerThan(&c4), Equals, true)
c.Assert(c3.SmallerThan(&c2), Equals, false)
c.Assert(c4.SmallerThan(&c2), Equals, false)
c.Assert(c4.SmallerThan(&c3), Equals, false)
}