class VarbinaryFunctions {

    @Description("Encode binary data as base64")
    @ScalarFunction
    @SqlType(StandardTypes.VARCHAR)
    public static Slice toBase64(@SqlType(StandardTypes.VARBINARY) Slice slice)
    {
        if (slice.hasByteArray()) {
            return Slices.wrappedBuffer(Base64.getEncoder().encode(slice.toByteBuffer()));
        }
        return Slices.wrappedBuffer(Base64.getEncoder().encode(slice.getBytes()));
    }

    private  VarbinaryFunctions();

}