DatabaseNotificationCursor

configureQuery

Calls the provided callback to configure the underlying query for this DatabaseNotificationCursor instance.

NameTypeRequiredDefaultDescription

callback

function

true

The callback called to configure the underlying query of this DatabaseNotificationCursor.

Return: The DatabaseNotificationCursor instance.

fetch

Executes the configured query and stores the pagination and results internally. Maps the resulting rows into DatabaseNotification instances.

NameTypeRequiredDefaultDescription

No arguments

Return: The DatabaseNotificationCursor instance.

hasNext

Returns true if there are more pages left in the cursor.

NameTypeRequiredDefaultDescription

No arguments

Return: boolean

next

Advances the page of the cursor and fetches the results.

NameTypeRequiredDefaultDescription

No arguments

Return: The DatabaseNotificationCursor instance.

Throws: Megaphone.DatabaseNotificationCursor.MaximumPageReached

hasPrevious

Returns true if there are more pages before the current page in the cursor.

NameTypeRequiredDefaultDescription

No arguments

Return: boolean

previous

Reverses the page of the cursor and fetches the results.

NameTypeRequiredDefaultDescription

No arguments

Return: The DatabaseNotificationCursor instance.

Throws: Megaphone.DatabaseNotificationCursor.MinimumPageReached

markAllAsRead

Marks all the notifications under the cursor as read.

This marks all the notifications the cursor applies to, not just the currently loaded page.

NameTypeRequiredDefaultDescription

readDate

date

false

now()

The date to use when marking the notifications as read.

Return: The DatabaseNotificationCursor instance.

deleteAll

Deletes all the notifications under the cursor.

This deletes all the notifications the cursor applies to, not just the currently loaded page.

NameTypeRequiredDefaultDescription

No arguments

Return: The DatabaseNotificationCursor instance.

Last updated