database namespace

Functions

Function Description
onValueCreated(ref, handler) Event handler which triggers when data is created in Realtime Database.
onValueCreated(opts, handler) Event handler which triggers when data is created in Realtime Database.
onValueDeleted(ref, handler) Event handler which triggers when data is deleted in Realtime Database.
onValueDeleted(opts, handler) Event handler which triggers when data is deleted in Realtime Database.
onValueUpdated(ref, handler) Event handler which triggers when data is updated in Realtime Database.
onValueUpdated(opts, handler) Event handler which triggers when data is updated in Realtime Database.
onValueWritten(ref, handler) Event handler which triggers when data is created, updated, or deleted in Realtime Database.
onValueWritten(opts, handler) Event handler which triggers when data is created, updated, or deleted in Realtime Database.

Classes

Class Description
DataSnapshot Interface representing a Firebase Realtime database data snapshot.

Interfaces

Interface Description
DatabaseEvent A CloudEvent that contains a DataSnapshot or a Change
RawRTDBCloudEvent
RawRTDBCloudEventData
ReferenceOptions ReferenceOptions extend EventHandlerOptions with provided ref and optional instance

database.onValueCreated()

Event handler which triggers when data is created in Realtime Database.

Signature:

export declare function onValueCreated<Ref extends string>(ref: Ref, handler: (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>;

Parameters

Parameter Type Description
ref Ref
handler (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>>) => any | Promise<any> Event handler which is run every time a Realtime Database create occurs.

Returns:

CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>

database.onValueCreated()

Event handler which triggers when data is created in Realtime Database.

Signature:

export declare function onValueCreated<Ref extends string>(opts: ReferenceOptions<Ref>, handler: (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>;

Parameters

Parameter Type Description
opts ReferenceOptions<Ref> Options that can be set on an individual event-handling function.
handler (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>>) => any | Promise<any> Event handler which is run every time a Realtime Database create occurs.

Returns:

CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>

database.onValueDeleted()

Event handler which triggers when data is deleted in Realtime Database.

Signature:

export declare function onValueDeleted<Ref extends string>(ref: Ref, handler: (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>;

Parameters

Parameter Type Description
ref Ref
handler (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>>) => any | Promise<any> Event handler which is run every time a Realtime Database deletion occurs.

Returns:

CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>

database.onValueDeleted()

Event handler which triggers when data is deleted in Realtime Database.

Signature:

export declare function onValueDeleted<Ref extends string>(opts: ReferenceOptions<Ref>, handler: (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>;

Parameters

Parameter Type Description
opts ReferenceOptions<Ref> Options that can be set on an individual event-handling function.
handler (event: DatabaseEvent<DataSnapshot, ParamsOf<Ref>>) => any | Promise<any> Event handler which is run every time a Realtime Database deletion occurs.

Returns:

CloudFunction<DatabaseEvent<DataSnapshot, ParamsOf<Ref>>>

database.onValueUpdated()

Event handler which triggers when data is updated in Realtime Database.

Signature:

export declare function onValueUpdated<Ref extends string>(ref: Ref, handler: (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>;

Parameters

Parameter Type Description
ref Ref
handler (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>) => any | Promise<any> Event handler which is run every time a Realtime Database update occurs.

Returns:

CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>

database.onValueUpdated()

Event handler which triggers when data is updated in Realtime Database.

Signature:

export declare function onValueUpdated<Ref extends string>(opts: ReferenceOptions<Ref>, handler: (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>;

Parameters

Parameter Type Description
opts ReferenceOptions<Ref> Options that can be set on an individual event-handling function.
handler (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>) => any | Promise<any> Event handler which is run every time a Realtime Database update occurs.

Returns:

CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>

database.onValueWritten()

Event handler which triggers when data is created, updated, or deleted in Realtime Database.

Signature:

export declare function onValueWritten<Ref extends string>(ref: Ref, handler: (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>;

Parameters

Parameter Type Description
ref Ref
handler (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>) => any | Promise<any> Event handler which is run every time a Realtime Database create, update, or delete occurs.

Returns:

CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>

database.onValueWritten()

Event handler which triggers when data is created, updated, or deleted in Realtime Database.

Signature:

export declare function onValueWritten<Ref extends string>(opts: ReferenceOptions<Ref>, handler: (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>) => any | Promise<any>): CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>;

Parameters

Parameter Type Description
opts ReferenceOptions<Ref> Options that can be set on an individual event-handling function.
handler (event: DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>) => any | Promise<any> Event handler which is run every time a Realtime Database create, update, or delete occurs.

Returns:

CloudFunction<DatabaseEvent<Change<DataSnapshot>, ParamsOf<Ref>>>