BuildQuery builds the arguments array for a DML event DELETE query. It returns the query string and the unique key arguments array. Returns an error if the number of arguments is not equal to the number of table columns.
(args []interface{})
| 833 | // It returns the query string and the unique key arguments array. |
| 834 | // Returns an error if the number of arguments is not equal to the number of table columns. |
| 835 | func (b *DMLDeleteQueryBuilder) BuildQuery(args []interface{}) (string, []interface{}, error) { |
| 836 | if len(args) != b.tableColumns.Len() { |
| 837 | return "", nil, fmt.Errorf("args count differs from table column count in BuildDMLDeleteQuery") |
| 838 | } |
| 839 | uniqueKeyArgs := make([]interface{}, 0, b.uniqueKeyColumns.Len()) |
| 840 | for _, column := range b.uniqueKeyColumns.Columns() { |
| 841 | tableOrdinal := b.tableColumns.Ordinals[column.Name] |
| 842 | arg := column.convertArg(args[tableOrdinal]) |
| 843 | uniqueKeyArgs = append(uniqueKeyArgs, arg) |
| 844 | } |
| 845 | return b.preparedStatement, uniqueKeyArgs, nil |
| 846 | } |
| 847 | |
| 848 | // DMLInsertQueryBuilder can build INSERT queries for DML events. |
| 849 | // It holds the prepared query statement so it doesn't need to be recreated every time. |