go-gorm / go-gorm/cli

refactor: rename `*Interface` types to idiomatic Go names in `field` package

Open
#47 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
108
Forks
15
PR merge metrics
No merged PRs in 30d

Description

## Summary

Several types in `field/interface.go` use an `*Interface` suffix that doesn't follow Go naming conventions. Go interfaces are named after the behavior they describe (e.g. `io.Reader`, `io.Closer`), not with an `Interface` suffix.

## Current

```go
type QueryInterface = clause.Expression
type AssociationInterface interface { ... }
type ColumnInterface interface { ... }
type OrderableInterface interface { ... }
type DistinctInterface interface { ... }
```

## Proposed

| Current | Proposed | Notes |
|---|---|---|
| `QueryInterface` | `Query` | Type alias — rename to `Query` or remove and use `clause.Expression` directly |
| `AssociationInterface` | `Association` | Free name, no clash |
| `ColumnInterface` | `Column` | Free name, no clash |
| `OrderableInterface` | `Orderable` | Free name, no clash |
| `DistinctInterface` | Remove | Duplicate of `Selectable` (same method: `buildSelectArg() any`) |

## Affected Files

- `field/interface.go` — type definitions
- All files referencing the renamed types

## References

- [Effective Go — Interfaces](https://go.dev/doc/effective_go#interfaces)
- [Go Code Review Comments — Interface names](https://github.com/golang/go/wiki/CodeReviewComments#interface-names)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.