Skip to content

Map String into ColumnSet #937

Answered by vitaly-t
kduraiswami asked this question in Q&A
Discussion options

You must be logged in to vote

There is something odd in your example about the prop usage. Making it the same for all columns confuses the parser. If you make it unique, then it works:

let insertColumnSet = new pgp.helpers.ColumnSet(
                tableConfig.columns.map((column, idx) => {
                    return {
                        name: column, 
                        prop: "_" + idx,
                        init: (col) => {
                            return col.source[column]
                        }
                    }
                }),
                {table: tableConfig.tableName}                
            );

I will look at it later, to figure out why prop is confused in this case. You have y…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
4 replies
@vitaly-t
Comment options

@kduraiswami
Comment options

@kduraiswami
Comment options

@vitaly-t
Comment options

Answer selected by kduraiswami
Comment options

You must be logged in to vote
2 replies
@vitaly-t
Comment options

@kduraiswami
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants