public static ClickHouseEnumValue of(ClickHouseValue ref, Enum<?> value) {
        ClickHouseEnumValue v;
        if (ref instanceof ClickHouseEnumValue) {
            v = (ClickHouseEnumValue) ref;
            if (value != null) {
                v.set(false, value.ordinal());
            } else {
                v.resetToNullOrEmpty();
            }
        } else {
            if (value != null) {
                v = new ClickHouseEnumValue(ClickHouseEnum.of(value.getClass()), false, value.ordinal());
            } else {
                v = new ClickHouseEnumValue(ClickHouseEnum.EMPTY, true, 0);
            }
        }
        return v;
    }
Update value of the given object or create a new instance if {@code ref} is
null.

@param ref   object to update, could be null
@param value value
@return same object as {@code ref} or a new instance if it's null
clickhouse-data/src/main/java/com/clickhouse/data/value/ClickHouseEnumValue.java