initial commit
This commit is contained in:
33
internal/domain/auth/query.go
Normal file
33
internal/domain/auth/query.go
Normal file
@@ -0,0 +1,33 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user