GetPrimaryKeyAndColumnTypes gets all primary columns and their types in ordinal order
(tctx *tcontext.Context, conn *BaseConn, meta TableMeta)
| 622 | |
| 623 | // GetPrimaryKeyAndColumnTypes gets all primary columns and their types in ordinal order |
| 624 | func GetPrimaryKeyAndColumnTypes(tctx *tcontext.Context, conn *BaseConn, meta TableMeta) ([]string, []string, error) { |
| 625 | var ( |
| 626 | colNames, colTypes []string |
| 627 | err error |
| 628 | ) |
| 629 | colNames, err = GetPrimaryKeyColumns(tctx, conn, meta.DatabaseName(), meta.TableName()) |
| 630 | if err != nil { |
| 631 | return nil, nil, err |
| 632 | } |
| 633 | colName2Type := string2Map(meta.ColumnNames(), meta.ColumnTypes()) |
| 634 | colTypes = make([]string, len(colNames)) |
| 635 | for i, colName := range colNames { |
| 636 | colTypes[i] = colName2Type[colName] |
| 637 | } |
| 638 | return colNames, colTypes, nil |
| 639 | } |
| 640 | |
| 641 | // GetPrimaryKeyColumns gets all primary columns in ordinal order |
| 642 | func GetPrimaryKeyColumns(tctx *tcontext.Context, db *BaseConn, database, table string) ([]string, error) { |
no test coverage detected