Skip to content
Discussion options

You must be logged in to vote

Ah, it looks like the magic I need is Map.RegisterDefaultPgType. The following worked:

 m := pgtype.NewMap()
 m.RegisterDefaultPgType(make([]Status, 0), "_int8")                                                                                                                                                                      
 if plan := m.PlanEncode(0, pgtype.TextFormatCode, make([]Status, 0)); plan == nil {
    panic("plan for []Status is nil") // OK
 }

As a documentation note, the value of the name argument to RegisterDefaultPgType was not at all clear. It says "PostgreSQL type name" but neither "BIGINT", nor "BIGINT[]", nor "_BIGINT" worked. I eventually figured it out by looking at t…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dpifke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant