Skip to content

Commit

Permalink
форматирование полей
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris committed Nov 2, 2024
1 parent 1702dae commit ab95528
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions modules/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -848,12 +848,14 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) {
for i := 0; i < s.Len(); i++ {
ss = ss + fmt.Sprintf(" %v,", s.Index(i))
}
f.WriteString(fmt.Sprintf("%s;", ss))
ss = strings.Replace(ss, "\n", "", -1)
ss = strings.Replace(ss, "\"", "\"\"", -1)
f.WriteString(fmt.Sprintf(`"%s";`, ss))

}
case reflect.String:
{
f.WriteString(fmt.Sprintf("%v;", strings.Replace(data.(string), "\n", "", -1)))
f.WriteString(fmt.Sprintf(`"%v";`, strings.Replace(strings.Replace(data.(string), "\n", "", -1), "\"", "\"\"", -1)))
}
default:
{
Expand Down Expand Up @@ -917,12 +919,13 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) {
for i := 0; i < s.Len(); i++ {
ss = ss + fmt.Sprintf(" %v,", s.Index(i))
}
f.WriteString(fmt.Sprintf("%s;", ss))

ss = strings.Replace(ss, "\n", "", -1)
ss = strings.Replace(ss, "\"", "\"\"", -1)
f.WriteString(fmt.Sprintf(`"%s";`, ss))
}
case reflect.String:
{
f.WriteString(fmt.Sprintf("%v;", strings.Replace(data.(string), "\n", "", -1)))
f.WriteString(fmt.Sprintf(`"%v";`, strings.Replace(strings.Replace(data.(string), "\n", "", -1), "\"", "\"\"", -1)))
}
default:
{
Expand Down
2 changes: 1 addition & 1 deletion modules/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@

package version

var Version = "extractor/v0.2.8"
var Version = "extractor/v0.2.9"

0 comments on commit ab95528

Please sign in to comment.