1
1
mirror of https://github.com/wader/fq.git synced 2024-11-28 03:02:55 +03:00
fq/format/avro/decoders/float.go
Mattias Wadman e9d9f8aef9 fq: Use go 1.18
Rename s/interface{}/any/g
Preparation for using generics in decode API and native jq funcations etc
Remove some unused linter ignores as linter has been fixed
2022-05-20 15:23:16 +02:00

15 lines
425 B
Go

package decoders
import (
"github.com/wader/fq/pkg/decode"
"github.com/wader/fq/pkg/scalar"
)
func decodeFloatFn(sms ...scalar.Mapper) (DecodeFn, error) {
// A float is written as 4 bytes. The float is converted into a 32-bit integer using a method equivalent to Java's
// floatToIntBits and then encoded in little-endian format.
return func(name string, d *decode.D) any {
return d.FieldF32(name, sms...)
}, nil
}