DatabaseNotificationCursor

configureQuery

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

Name
Type
Required
Default
Description

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.

Name
Type
Required
Default
Description

No arguments

Return: The DatabaseNotificationCursor instance.

hasNext

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

Name
Type
Required
Default
Description

No arguments

Return: boolean

next

Advances the page of the cursor and fetches the results.

Name
Type
Required
Default
Description

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.

Name
Type
Required
Default
Description

No arguments

Return: boolean

previous

Reverses the page of the cursor and fetches the results.

Name
Type
Required
Default
Description

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.

Name
Type
Required
Default
Description

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.

Name
Type
Required
Default
Description

No arguments

Return: The DatabaseNotificationCursor instance.

Last updated