Cols returns the columns of the table in public state.
()
| 321 | |
| 322 | // Cols returns the columns of the table in public state. |
| 323 | func (t *TableInfo) Cols() []*ColumnInfo { |
| 324 | publicColumns := make([]*ColumnInfo, len(t.Columns)) |
| 325 | maxOffset := -1 |
| 326 | for _, col := range t.Columns { |
| 327 | if col.State != StatePublic { |
| 328 | continue |
| 329 | } |
| 330 | publicColumns[col.Offset] = col |
| 331 | if maxOffset < col.Offset { |
| 332 | maxOffset = col.Offset |
| 333 | } |
| 334 | } |
| 335 | return publicColumns[0 : maxOffset+1] |
| 336 | } |
| 337 | |
| 338 | // FindIndexByName finds index by name. |
| 339 | func (t *TableInfo) FindIndexByName(idxName string) *IndexInfo { |
no outgoing calls