Sha256: aa42c0e4273222d946447d4eec0ff3b5048ab27bebfd715dbc10d86992fe20f1
Contents?: true
Size: 1.76 KB
Versions: 3
Compression:
Stored size: 1.76 KB
Contents
.TH Page .PP Pagination .SH Signature .PP .RS .nf page(operand: Relation, ordering: Ordering, nth: Integer) \-> Relation .fi .RE .SH Examples .PP .RS .nf page(suppliers, [:status, :sid], 1, page_size: 3) .fi .RE .PP .RS .nf page(suppliers, [:status, :sid], \-1, page_size: 3) .fi .RE .SH Description .PP Computes a relation by restricting the tuples of \fB\fCoperand\fR to those belonging to the \fB\fCnth\fR page (starting at 1). When \fB\fCnth\fR is negative, returns tuples that belong to the \fB\fCnth\fR page from the end (e.g., \-1 is last page). .PP Formally, the page is defined by those tuples whose ranking according to \fB\fCorder\fR is such that \fB\fC(nth\-1)*page_size <= rank < nth*page_size\fR\&. In other words, this operator is almost equivalent to the following definition (ignoring negative page indexes for simplicity): .PP .RS .nf def page(operand, order, nth, page_size) allbut( restrict( rank(operand, order, :rank), lte((nth\-1)*page_size, :rank) & lt(:rank, nth*page_size)), [:rank]) end page(suppliers, [:status, :sid], 1, 3) .fi .RE .PP As of current Alf version, for this operator to be semantically sound and deterministic, \fB\fCorder\fR MUST be a total order, that is, it must at least cover a candidate key. As of current Alf version, no error is raised if this is not the case but that might change in future versions. .SH Implementation notes .PP Contrary to the longer expression shown above, this operator compiles to SQL (rank does not, so far) at the cost of having to provide a total order. .PP As the result is a relation and relations are not ordered by definition, the order in which tuples can be observed in the result (e.g. through explicit tuple iteration, casting to an array, json encoding) is NOT guaranteed to follow \fB\fCorder\fR\&.
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
alf-shell-0.16.3 | doc/man/page.man |
alf-shell-0.16.2 | doc/man/page.man |
alf-shell-0.16.1 | doc/man/page.man |