0

This code:

func DoStuff(input []Resource) {
    rowsToken := [][]interface{}{}
    for _, data := range input {
        rowsToken = append(rowsToken, []interface{}{data.TokenID, data.Class})
    }
    _, err := IDB.CopyFrom(ctx, pgx.Identifier{"someTable"},
        []string{"id", "localization_id"}, pgx.CopyFromRows(rowsToken))
    tool.CheckError(err, "info")
}

Is giving me this error:

Cannot use (pgx.Identifier literal) (value of type pgx.Identifier) as pgx.Identifier value in argument to IDB.CopyFrom

I've been using this as is in several other functions, don't know what I am doing wrong.

Here is pgx's documentation: https://godoc.org/github.com/jackc/pgx

Gabriel
  • 5,453
  • 14
  • 63
  • 92
  • some info about the IDB, pgx packages (godoc links?) would be helpful – Chayan Ghosh Aug 03 '20 at 00:18
  • @ChayanGhosh Added the link to the docs in the body. Thank you! – Gabriel Aug 03 '20 at 01:06
  • 1
    the problem might be with multiple instances of the same library being referred to. If you are using dep for package management, ensure that you have dep ensured pgx properly. It's possible that the IDB.CopyFrom implementation is not using the same instance of pgx as the source code here that references pgx directly. – Chayan Ghosh Aug 03 '20 at 01:27
  • In the same package I have another function that also uses IDB and works fine. I'm not sure if has something to do with dependencies. – Gabriel Aug 03 '20 at 02:28

0 Answers0