(schemaName string, table *schema.Table, records []arrow.RecordBatch)
| 69 | } |
| 70 | |
| 71 | func TVPQuery(schemaName string, table *schema.Table, records []arrow.RecordBatch) (query string, params []any, err error) { |
| 72 | rows, err := GetRows(array.NewTableFromRecords(table.ToArrowSchema(), records)) |
| 73 | if err != nil { |
| 74 | return "", nil, err |
| 75 | } |
| 76 | |
| 77 | return "exec " + sanitizeID(schemaName, tvpProcName(table)) + " @TVP;", |
| 78 | []any{ |
| 79 | sql.Named("TVP", mssql.TVP{ |
| 80 | TypeName: sanitizeID(schemaName, tvpTableType(table)), |
| 81 | Value: tableTransformer(table)(rows), |
| 82 | }), |
| 83 | }, |
| 84 | nil |
| 85 | } |
| 86 | |
| 87 | type transformer func([][]any) any |
| 88 |
nothing calls this directly
no test coverage detected