diff --git a/default_values.go b/default_values.go index d9b98b1..ab1d24b 100644 --- a/default_values.go +++ b/default_values.go @@ -1,4 +1,4 @@ -package util +package webutility // IntOrDefault ... func IntOrDefault(v *int) int { diff --git a/diff.go b/diff.go index c9ab90e..6dadac1 100644 --- a/diff.go +++ b/diff.go @@ -1,4 +1,4 @@ -package util +package webutility // Diff ... func Diff(old, new []int64) (added, removed []int64) { diff --git a/file_util.go b/file_util.go index e856d7d..98c24b5 100644 --- a/file_util.go +++ b/file_util.go @@ -1,4 +1,4 @@ -package util +package webutility import ( "bytes" diff --git a/int_util.go b/int_util.go index 14c59d3..8b32a7d 100644 --- a/int_util.go +++ b/int_util.go @@ -1,4 +1,4 @@ -package util +package webutility import ( "fmt" diff --git a/nullables.go b/nullables.go index c99385f..a6b2a19 100644 --- a/nullables.go +++ b/nullables.go @@ -1,4 +1,4 @@ -package util +package webutility import ( "database/sql" diff --git a/payload.go b/payload.go index 6a7004e..da875a3 100644 --- a/payload.go +++ b/payload.go @@ -12,7 +12,6 @@ import ( "time" "git.to-net.rs/marko.tikvic/gologger" - "git.to-net.rs/marko.tikvic/util" ) var ( @@ -24,9 +23,9 @@ var ( metadataDB *sql.DB activeProject string - inited bool - driver string - logger *gologger.Logger + inited bool + metaDriver string + logger *gologger.Logger ) // LangMap ... @@ -140,7 +139,7 @@ func InitPayloadsMetadata(drv string, db *sql.DB, project string) error { return err } - driver = drv + metaDriver = drv metadataDB = db activeProject = project @@ -209,13 +208,13 @@ func UpdateEntityModels(command string) (total, upd, add int, err error) { } var uStmt *sql.Stmt - if driver == "ora" { + if metaDriver == "ora" { uStmt, err = metadataDB.Prepare("update entities set entity_model = :1 where entity_type = :2") if err != nil { logger.Trace(err.Error()) return } - } else if driver == "mysql" { + } else if metaDriver == "mysql" { uStmt, err = metadataDB.Prepare("update entities set entity_model = ? where entity_type = ?") if err != nil { logger.Trace(err.Error()) @@ -233,13 +232,13 @@ func UpdateEntityModels(command string) (total, upd, add int, err error) { blankPayload, _ := json.Marshal(Payload{}) var iStmt *sql.Stmt - if driver == "ora" { + if metaDriver == "ora" { iStmt, err = metadataDB.Prepare("insert into entities(projekat, metadata, entity_type, entity_model) values(:1, :2, :3, :4)") if err != nil { logger.Trace(err.Error()) return } - } else if driver == "mysql" { + } else if metaDriver == "mysql" { iStmt, err = metadataDB.Prepare("insert into entities(projekat, metadata, entity_type, entity_model) values(?, ?, ?, ?)") if err != nil { logger.Trace(err.Error()) @@ -303,7 +302,7 @@ func initMetadata(project string) error { // // TODO(marko): Currently supports only one hardcoded language... func LoadMetadataFromFile(path string) error { - lines, err := util.ReadFileLines(path) + lines, err := ReadFileLines(path) if err != nil { return err } @@ -317,7 +316,7 @@ func LoadMetadataFromFile(path string) error { continue } - if util.IsWrappedWith(l, "[", "]") { + if IsWrappedWith(l, "[", "]") { name = strings.Trim(l, "[]") p := Payload{} p.addLang("sr", make(map[string]string)) diff --git a/string_sanitisation.go b/string_sanitisation.go index c6cdee4..5774efb 100644 --- a/string_sanitisation.go +++ b/string_sanitisation.go @@ -1,10 +1,8 @@ package webutility -import "git.to-net.rs/marko.tikvic/util" - const patern = "\"';&*<>=\\`:" // SanitiseString removes characters from s found in patern and returns new modified string. func SanitiseString(s string) string { - return util.ReplaceAny(s, patern, "") + return ReplaceAny(s, patern, "") } diff --git a/string_util.go b/string_util.go index 07f7155..5ef9d84 100644 --- a/string_util.go +++ b/string_util.go @@ -1,4 +1,4 @@ -package util +package webutility import ( "fmt"