Back to Pocketbase

Interface ModelQuery

static/jsvm/interfaces/dbx.ModelQuery.html

latest2.9 KB
Original Source

Interface ModelQuery

ModelQuery represents a query associated with a struct model.

Hierarchy

  • ModelQuery

Index

Methods

contextdeleteexcludeinsertupdatewithContext

Methods

context

Context returns the context associated with the query.

Returns context.Context

delete

  • delete(): void

Delete deletes a row in the table using the primary key specified by the struct model associated with this query.

Returns void

exclude

Exclude excludes the specified struct fields from being inserted/updated into the DB table.

Parameters

Rest ...attrs: string[]

Returns ModelQuery

insert

  • insert(...attrs): void

Insert inserts a row in the table using the struct model associated with this query.

By default, it inserts all public fields into the table, including those nil or empty ones. You may pass a list of the fields to this method to indicate that only those fields should be inserted. You may also call Exclude to exclude some fields from being inserted.

If a model has an empty primary key, it is considered auto-incremental and the corresponding struct field will be filled with the generated primary key value after a successful insertion.

Parameters

Rest ...attrs: string[]

Returns void

update

  • update(...attrs): void

Update updates a row in the table using the struct model associated with this query. The row being updated has the same primary key as specified by the model.

By default, it updates all public fields in the table, including those nil or empty ones. You may pass a list of the fields to this method to indicate that only those fields should be updated. You may also call Exclude to exclude some fields from being updated.

Parameters

Rest ...attrs: string[]

Returns void

withContext

WithContext associates a context with the query.

Parameters

ctx: context.Context

Returns ModelQuery

Settings

Member Visibility

  • Inherited

Theme

OSLightDark

On This Page

Generated using TypeDoc