fix: typo `sql tempalte` and minor style issues in `internal/gen`
- Dominant language
- Go
- Stars
- 108
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
A few small issues in `internal/gen/`:
### 1. Typo in panic message
`internal/gen/sqlparser.go:90`:
```go
panic(fmt.Sprintf("unsupported func %q in sql tempalte\n", f.Name))
```
`tempalte` → `template`
### 2. Abbreviated variable name `pth`
`internal/gen/generator.go:110`:
```go
for pth, file := range g.Files {
```
`pth` is an abbreviation that saves 1 character over `path`. In a 30-line block it adds no value. Use `path` or `filePath` for readability.
### 3. Operator precedence ambiguity
`internal/gen/generator.go:630`:
```go
if method.SQL.Where == "" && method.SQL.Select == "" || method.SQL.Raw != "" {
```
The `||` binds loosely. Add explicit parens to make intent clear:
```go
if (method.SQL.Where == "" && method.SQL.Select == "") || method.SQL.Raw != "" {
```
### 4. Verbose local in `sqlparser.go`
`internal/gen/sqlparser.go:326-343`:
```go
paramsCount := 0 // used in 4 adjacent lines
codes := []string{} // used in 4 adjacent lines
```
Shorter names like `count` and `lines` would suffice for the narrow scope.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.