PHI

Omit

Omit specifies which scalar fields should be excluded from a query result.

Unlike Select, Omit only applies to scalar fields. Relations are never loaded unless explicitly selected with Select.

Omitting Scalar Fields

Omit scalar fields by setting their corresponding field to true. Set a field to false (or leave it unset) to include it in the result.

users, err := db.User.
    FindMany(user.Email.EQ("x@y.com")).
    Omit(user.Omit{
        Id:    true,
        Email: true,
        Bio:   true,
    }).
    Exec(ctx)

Note: Select and Omit are mutually exclusive. Attempting to use both on the same query will result in an error.

Supported By

Omit is supported by: