Documentation
/**

.

# Examples

```
use caisin::sqls::get_select_fields;

assert_eq!(get_select_fields("select `a`, b,`c` from "),vec!["a","b","c"] );
```
*/
pub fn get_select_fields(select_sql: &str) -> Vec<&str> {
    let mut star_idx = 0;
    let mut idx = 0;
    let mut ret = vec![];
    let s = select_sql.find("select ").unwrap();
    let e = select_sql.find("from").unwrap();
    let mut in_field = true;
    let mut field = "";
    for c in select_sql[s..e].chars() {
        if !in_field && !field.is_empty() {
            ret.push(field);
            field = "";
        }
        match c {
            ' ' | ',' | '`' | '\r' | '\t' | '\n' => {
                if star_idx == 0 {
                    star_idx = idx;
                } else {
                    //两个空格
                    if idx - star_idx == 1 {
                        star_idx = idx;
                    } else {
                        field = &select_sql[(star_idx + 1)..idx];
                        star_idx = idx;
                    }
                }
            }
            _ => {}
        }

        match c {
            ',' => {
                in_field = false;
            }
            _ => in_field = true,
        }

        idx += 1;
    }
    if !field.is_empty() {
        ret.push(field);
    }
    ret
}

#[test]
fn test_f() {
 
}