[][src]Function postgres_query::extract::split_columns_many

pub fn split_columns_many<'a, S>(
    columns: &'a [Column],
    splits: &'a [S]
) -> impl Iterator<Item = Result<Range<usize>, Error>> + 'a where
    S: AsRef<str>, 

Split a row's columns into multiple partitions based on some split-points.

Split

Given a list of column labels, a split is made right before the first column with a matching name following the previous split:

Labels:       a,    a,      c,  a
Indices:      0 1 2 3 4 5 6 7 8 9 10
Columns:      a b c a b a b c b a c
Splits:      |     |       |   |   
Partitions: + +---+ +-----+ +-+ +-+
Ranges:     [0..0, 0..3, 3..7, 7..9, 9..11]`

The first partition always contains the leading columns (zero or more):

Labels:         b,  a
Indices:    0 1 2 3 4 5
Columns:    d a b c a b
Splits:        |   |
Partitions: +-+ +-+ +-+
Ranges:     [0..2, 2..4, 4..6]

Errors

Will return an error if the columns could not be split (ie. no column with a matching name was found in the remaining columns).