usercmd

package
v0.0.0-...-bcf6333 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateUserCommand

type CreateUserCommand struct {
	//Email is the new User's Email field.
	Email string

	//Enabled is the new User's Enabeld field.
	Enabled bool

	//ClientIds is the new User's ClientIds field.
	ClientIds []data.Id
}

CreateUserCommand is a Command that should be used to create a new User.

type Handler

type Handler struct {
	//Users is the repo to use to manager Users.
	Users user.Repo
}

Handler is a type that knows how to handle all related User commands for the command bus in the application.

func (*Handler) CreateUser

func (h *Handler) CreateUser(ctx context.Context, cmd cbus.Command) (interface{}, error)

CreateUser attempts to create a new User and add it to h.Users. Cmd must be of type *CreateUserCommand. The result, if not nil and without error, is a *user.User.

func (*Handler) UpdateUser

func (h *Handler) UpdateUser(ctx context.Context, cmd cbus.Command) (interface{}, error)

UpdateUser attempts to update a User from cmd. Cmd must be of type *UpdateUserCommand. The result, if not nil and without error, is a *user.User.

type UpdateUserCommand

type UpdateUserCommand struct {
	//Id is the Id of the User to update.
	Id data.Id

	//Email, if not nil, is the email to set on the User.
	Email *string

	//Enabled, if not nil, is the enabled value to set on the User.
	Enabled *bool

	//ClientIds, if not nil, is the slice of client ids to set on the User.
	ClientIds *[]data.Id
}

UpdateUserCommand is a Command that should be used to update single User entities.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL