Skip to content

Get the column name #6

@happilymarrieddad

Description

@happilymarrieddad

Is there a way to get the name of the column when you are reading from an event. I've looked through the code and I can't seem to find a good way to do this. Getting the values and the tableId are useful but not if I don't know what the column name for that table is. Here is an example

case *myreplication.WriteEvent:
				Output Write (insert) event
				println("Write", e.GetTable())
				println("NewID", e.GetTableId())
				spew.Dump(e)
				//Rows loop
				for _, row := range e.GetRows() {
					//Columns loop
					fmt.Println("")
					fmt.Println("Row")
					spew.Dump(row)
					fmt.Println("End Row")
					for _, col := range row {
						fmt.Println("Col")
						spew.Dump(col)
						
                                               // HERE IT WOULD BE NICE IF I COULD KNOW THE COLUMN NAME 
                                               
                                               // fmt.Println(col.GetColumnName())
						fmt.Println("EndCol")
						fmt.Println("")
						//Output row number, column number, column type and column value
						//println(fmt.Sprintf("%d %d %d %v", i, j, col.GetType(), col.GetValue()))
					}
				}

Or if there is a way to read the event into a table struct? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions