Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var HandleSqlForRecord = func(sql string) []string { split := SplitSqlBySemicolon(sql) for i := range split { p0 := strings.Index(split[i], stripCloudUser) if p0 >= 0 { split[i] = split[i][0:p0] + split[i][p0+len(stripCloudUser):len(split[i])] } p0 = strings.Index(split[i], stripCloudNonUser) if p0 >= 0 { split[i] = split[i][0:p0] + split[i][p0+len(stripCloudNonUser):len(split[i])] } p0 = strings.Index(split[i], stripSaveQuery) if p0 >= 0 { split[i] = split[i][0:p0] + split[i][p0+len(stripCloudNonUser):len(split[i])] } scanner := mysql.NewScanner(dialect.MYSQL, split[i]) indexes := []int{-1} eq := int('=') for scanner.Pos < len(split[i]) { typ, s := scanner.Scan() if typ == mysql.IDENTIFIED { typ, _ = scanner.Scan() if typ == mysql.BY || typ == mysql.WITH { typ, s = scanner.Scan() if typ != mysql.RANDOM { indexes = append(indexes, scanner.Pos-len(s)-1, scanner.Pos-2) } } } else if s == "access_key_id" || s == "secret_access_key" { typ, _ = scanner.Scan() if typ == eq { _, s = scanner.Scan() indexes = append(indexes, scanner.Pos-len(s)-1, scanner.Pos-2) } } } indexes = append(indexes, len(split[i])) if len(indexes) > 2 { var builder strings.Builder for j := 0; j < len(indexes); j += 2 { builder.WriteString(split[i][indexes[j]+1 : indexes[j+1]]) if j < len(indexes)-2 { builder.WriteString("******") } } split[i] = builder.String() } split[i] = strings.TrimSpace(split[i]) } return split }
Functions ¶
func SplitSqlBySemicolon ¶ added in v0.8.0
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.