From b3b60e8b60f38b2e709ae0b0dd1ae5686afdcc63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Tikvi=C4=87?= Date: Mon, 26 Mar 2018 11:50:03 +0200 Subject: [PATCH] string sanitisation --- sql_sequrity.go | 13 ------------- string_sanitisation.go | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 sql_sequrity.go create mode 100644 string_sanitisation.go diff --git a/sql_sequrity.go b/sql_sequrity.go deleted file mode 100644 index f0fd689..0000000 --- a/sql_sequrity.go +++ /dev/null @@ -1,13 +0,0 @@ -package webutility - -import "strings" - -var patern string = "\"';&*<>=\\`:" - -// SQLSafeString removes characters from s found in patern and returns new modified string. -func SQLSafeString(s string) (safe string) { - for _, c := range patern { - safe = strings.Replace(s, string(c), "", -1) - } - return safe -} diff --git a/string_sanitisation.go b/string_sanitisation.go new file mode 100644 index 0000000..8b81b3f --- /dev/null +++ b/string_sanitisation.go @@ -0,0 +1,13 @@ +package webutility + +import "strings" + +var patern string = "\"';&*<>=\\`:" + +// SQLSafeString removes characters from s found in patern and returns new modified string. +func SanitiseString(s string) (safe string) { + for _, c := range patern { + safe = strings.Replace(s, string(c), "", -1) + } + return safe +} -- 1.8.1.2