(command *ast.SelectCommand)
| 624 | } |
| 625 | |
| 626 | func (table *Table) applyOffsetAndLimit(command *ast.SelectCommand) { |
| 627 | var offset = 0 |
| 628 | var limitRaw = -1 |
| 629 | |
| 630 | if command.HasLimitCommand() { |
| 631 | limitRaw = command.LimitCommand.Count |
| 632 | } |
| 633 | if command.HasOffsetCommand() { |
| 634 | offset = command.OffsetCommand.Count |
| 635 | } |
| 636 | |
| 637 | for _, column := range table.Columns { |
| 638 | var limit int |
| 639 | |
| 640 | if limitRaw == -1 || limitRaw+offset > len(column.Values) { |
| 641 | limit = len(column.Values) |
| 642 | } else { |
| 643 | limit = limitRaw + offset |
| 644 | } |
| 645 | |
| 646 | if offset > len(column.Values) || limit == 0 { |
| 647 | column.Values = make([]ValueInterface, 0) |
| 648 | } else { |
| 649 | column.Values = column.Values[offset:limit] |
| 650 | } |
| 651 | } |
| 652 | } |
| 653 | |
| 654 | func xor(fulfilledFilters bool, negation bool) bool { |
| 655 | return (fulfilledFilters || negation) && !(fulfilledFilters && negation) |
no test coverage detected