package services import ( "strings" ) const ( ES_URL = "http://es-cn-nif227b580019rgw6.public.elasticsearch.aliyuncs.com:9200" //<1> ES_USERNAME = "elastic" //<2> ES_PASSWORD = "hongze@2021" //<3> //Grafana pwd-> 20521bb9 //Grafana username-> emon ) func RemoveDuplicatesAndEmpty(a []string) (ret []string) { a_len := len(a) for i := 0; i < a_len; i++ { if (i > 0 && a[i-1] == a[i]) || len(a[i]) == 0 { continue } ret = append(ret, a[i]) } return } // KeyWordArrSqlRegexp 预处理ik联想词的模糊查询语句 func KeyWordArrSqlRegexp(a []string) (ret string) { a_len := len(a) for i := 0; i < a_len; i++ { if i == 0 { continue } ret += a[i] + "|" } ret = strings.TrimRight(ret, "|") return } // KeyWordArrSqlRegexp 预处理ik联想词的模糊查询语句 func KeyWordArrSqlRegexpAll(a []string) (ret string) { a_len := len(a) for i := 0; i < a_len; i++ { ret += a[i] + "|" } ret = strings.TrimRight(ret, "|") //ret = "'" + ret + "'" return }