

package org.apache.shardingsphere.database.protocol.mysql.packet.command.query.binary.execute.protocol;

import org.apache.shardingsphere.database.protocol.mysql.payload.MySQLPacketPayload;

/**
 * Binary protocol value for float for MySQL.
 */
public final class MySQLFloatBinaryProtocolValue implements MySQLBinaryProtocolValue {
    
    @Override
    public Object read(final MySQLPacketPayload payload) {
        return payload.getByteBuf().readFloatLE();
    }
    
    @Override
    public void write(final MySQLPacketPayload payload, final Object value) {
        payload.getByteBuf().writeFloatLE(Float.parseFloat(value.toString()));
    }
}
