Make `schema.Column.Generated` private so callers ask `IsGenerated` or other API
- Dominant language
- Go
- Stars
- 24.4k
- Forks
- 873
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 120
Description
`schema.Column.Generated` holds the expression text of a generated column, and its emptiness is what tells the rest of the codebase whether a column is generated. So far every caller has to know this convention. Nothing stops a caller reaching for `Virtual` instead. A zero value usually conveys an empty value for later use, but this one is asserting something about the column.
```sh
$ grep -rn 'Generated != ""' --include="*.go" libraries/ | grep -v _test.go | grep -v schema/column.go
libraries/doltcore/merge/merge_prolly_rows.go:1491: if col.Default != "" || col.Generated != "" || col.OnUpdate != "" {
libraries/doltcore/merge/merge_prolly_rows.go:1543: if col.Generated != "" && !col.Virtual {
libraries/doltcore/merge/merge_prolly_rows.go:1751: if col.Default != "" || col.Generated != "" || col.OnUpdate != "" {
libraries/doltcore/merge/merge_prolly_rows.go:1758: if col.Generated != "" {
libraries/doltcore/merge/merge_prolly_rows.go:2157: generatedColumn := resultColumn.Generated != ""
libraries/doltcore/sqle/sqlfmt/schema_fmt.go:210: if col.Generated != "" {
libraries/doltcore/sqle/sqlutil/convert.go:48: if col.Generated != "" {
libraries/doltcore/schema/encoding/serialization.go:272: serial.ColumnAddGenerated(b, col.Generated != "")
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with libraries/doltcore/schema/column.go to understand Column.Generated, then inspect each non-test caller listed by the grep output, including the merge, formatting, conversion, and serialization files. Replace direct convention checks with the chosen public API and verify that all callers build and preserve generated-column behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- databases
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100