ModelQuery represents a query associated with a struct model.

Hierarchy

  • ModelQuery

Methods

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

    Returns void

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

    Parameters

    • Rest ...attrs: string[]

    Returns ModelQuery

  • 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 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

Generated using TypeDoc