DataFrame inplace change columns order

I propose this way to get some clarification on a possible implementation (even if it doesn’t make sense to do it, for some reason).

nt=Tables.columntable(df)
perm=[3,2,4,5,1]
DataFrame(NamedTuple{Tuple(permute!(collect(keys(nt)),perm ))}(nt))

I would like to know if and how to use a generated function similar to what @aplavin did here

@generated sortkeys(nt::NamedTuple{KS}) where {KS} =
    :( NamedTuple{$(Tuple(sort(collect(KS))))}(nt) )