Add ReadDecimal helper

This commit is contained in:
2018-11-30 11:17:59 +01:00
parent 57d2b30132
commit 2f12207dbe
2 changed files with 13 additions and 3 deletions
+12
View File
@@ -170,3 +170,15 @@ func (b *Buffer) WriteStringLenEnc(s string) {
func (b *Buffer) WriteStringEOF(s string) {
b.pos += copy(b.data[b.pos:], s)
}
//
// Special types
//
// ReadDecimal decodes a decimal value from the buffer anf then advances cursor
// accordingly.
func (b *Buffer) ReadDecimal(precision, decimals int) mysql.Decimal {
dec, n := mysql.DecodeDecimal(b.Cur(), precision, decimals)
b.Skip(n)
return dec
}