fix staticcheck suggestions
This commit is contained in:
@@ -12,10 +12,8 @@ func ReadParams(input string) []string {
|
|||||||
params := []string{}
|
params := []string{}
|
||||||
|
|
||||||
matches := paramRegexp.FindAllStringSubmatch(input, -1)
|
matches := paramRegexp.FindAllStringSubmatch(input, -1)
|
||||||
if matches != nil {
|
for _, match := range matches {
|
||||||
for _, match := range matches {
|
params = append(params, match[1])
|
||||||
params = append(params, match[1])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|||||||
@@ -57,10 +57,8 @@ func (query *Query) Bind(name string, value any) *Query {
|
|||||||
|
|
||||||
// BindMap assigns values to bind parameters.
|
// BindMap assigns values to bind parameters.
|
||||||
func (query *Query) BindMap(params map[string]any) *Query {
|
func (query *Query) BindMap(params map[string]any) *Query {
|
||||||
if params != nil {
|
for name, value := range params {
|
||||||
for name, value := range params {
|
query.Params[name] = value
|
||||||
query.Params[name] = value
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
@@ -68,9 +66,7 @@ func (query *Query) BindMap(params map[string]any) *Query {
|
|||||||
// Copy creates a copy of the query.
|
// Copy creates a copy of the query.
|
||||||
func (query *Query) Copy() *Query {
|
func (query *Query) Copy() *Query {
|
||||||
newQuery := NewQuery()
|
newQuery := NewQuery()
|
||||||
for _, line := range query.Lines {
|
newQuery.Lines = append(newQuery.Lines, query.Lines...)
|
||||||
newQuery.Lines = append(newQuery.Lines, line)
|
|
||||||
}
|
|
||||||
for name, value := range query.Params {
|
for name, value := range query.Params {
|
||||||
newQuery.Params[name] = value
|
newQuery.Params[name] = value
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user