Skip to content

Commit 62e1b16

Browse files
authored
feat!: Depracate override columns (#86)
feat: Depracate override columns
1 parent 55630d4 commit 62e1b16

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

codegen/golang.go

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@ func WithSkipFields(fields []string) TableOptions {
6969
}
7070
}
7171

72-
func WithOverrideColumns(columns []ColumnDefinition) TableOptions {
73-
return func(t *TableDefinition) {
74-
t.overrideColumns = columns
75-
}
76-
}
77-
7872
func WithExtraColumns(columns []ColumnDefinition) TableOptions {
7973
return func(t *TableDefinition) {
8074
t.extraColumns = columns
@@ -122,15 +116,7 @@ func NewTableFromStruct(name string, obj interface{}, opts ...TableOptions) (*Ta
122116
comments = readStructComments(e.Type().PkgPath(), e.Type().Name())
123117
}
124118

125-
for _, c := range t.extraColumns {
126-
if t.overrideColumns != nil {
127-
if col := t.overrideColumns.GetByName(c.Name); col != nil {
128-
t.Columns = append(t.Columns, *col)
129-
continue
130-
}
131-
}
132-
t.Columns = append(t.Columns, c)
133-
}
119+
t.Columns = append(t.Columns, t.extraColumns...)
134120

135121
for i := 0; i < e.NumField(); i++ {
136122
field := e.Type().Field(i)
@@ -144,13 +130,6 @@ func NewTableFromStruct(name string, obj interface{}, opts ...TableOptions) (*Ta
144130
continue
145131
}
146132

147-
if t.overrideColumns != nil {
148-
if col := t.overrideColumns.GetByName(t.nameTransformer(field.Name)); col != nil {
149-
t.Columns = append(t.Columns, *col)
150-
continue
151-
}
152-
}
153-
154133
columnType, err := valueToSchemaType(field.Type)
155134
if err != nil {
156135
fmt.Printf("skipping field %s, got err: %v\n", field.Name, err)

codegen/table.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ type TableDefinition struct {
2222
PreResourceResolver string
2323
nameTransformer func(string) string
2424
skipFields []string
25-
overrideColumns ColumnDefinitions
2625
extraColumns ColumnDefinitions
2726
descriptionsEnabled bool
2827
}

0 commit comments

Comments
 (0)