fix staticcheck suggestions

This commit is contained in:
Aneurin Barker Snook
2023-11-25 16:51:25 +00:00
parent 0d5a852860
commit 1895ee990a
2 changed files with 5 additions and 11 deletions
+2 -4
View File
@@ -12,10 +12,8 @@ func ReadParams(input string) []string {
params := []string{}
matches := paramRegexp.FindAllStringSubmatch(input, -1)
if matches != nil {
for _, match := range matches {
params = append(params, match[1])
}
for _, match := range matches {
params = append(params, match[1])
}
return params
+3 -7
View File
@@ -57,10 +57,8 @@ func (query *Query) Bind(name string, value any) *Query {
// BindMap assigns values to bind parameters.
func (query *Query) BindMap(params map[string]any) *Query {
if params != nil {
for name, value := range params {
query.Params[name] = value
}
for name, value := range params {
query.Params[name] = value
}
return query
}
@@ -68,9 +66,7 @@ func (query *Query) BindMap(params map[string]any) *Query {
// Copy creates a copy of the query.
func (query *Query) Copy() *Query {
newQuery := NewQuery()
for _, line := range query.Lines {
newQuery.Lines = append(newQuery.Lines, line)
}
newQuery.Lines = append(newQuery.Lines, query.Lines...)
for name, value := range query.Params {
newQuery.Params[name] = value
}