Files
base/internal/domain/auth/query.go
2026-04-10 18:25:21 +03:30

34 lines
730 B
Go

package auth
// UserQueryOption represents options for querying users
type UserQueryOption func(*UserQueryOptions)
// UserQueryOptions holds options for user queries
type UserQueryOptions struct {
LoadRoles bool
LoadAccounts bool
}
// WithRoles enables loading of user roles
func WithRoles() UserQueryOption {
return func(opts *UserQueryOptions) {
opts.LoadRoles = true
}
}
// WithAccounts enables loading of user accounts
func WithAccounts() UserQueryOption {
return func(opts *UserQueryOptions) {
opts.LoadAccounts = true
}
}
// WithRelations enables loading of all relations
func WithRelations() UserQueryOption {
return func(opts *UserQueryOptions) {
opts.LoadRoles = true
opts.LoadAccounts = true
}
}