Replies: 1 comment
-
Maybe something like this: // first two rows
stmt := UNION(
SELECT(String(row[0].UserID).AS("first")/*, more columns*/),
SELECT(String(row[1].UserID)/*, more columns*/),
)
// the rest of rows
for i := 2; i < len(rows); i++ {
stmt = UNION(
stmt,
SELECT(String(row[i].UserID)/*, more columns*/),
)
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Following this issue #69, I am trying to add a variable number of expressions into UNION.
Since the function requires at least 2 arguments, I am duplicating the first row, and then the rest of the input is programmatically created.
Problem with this approach is that the type of the slice is wrong, and
jet.SerializableStatement
doesn't seem to be an exportable type by the package, so I am stuck. What is the correct way to do this?Maybe a more general question: Given a slice of structs, I would like to convert it into a table that I can use. How do I do it?
Beta Was this translation helpful? Give feedback.
All reactions