Documentation ¶
Overview ¶
Code generated by fertilize; DO NOT EDIT.
Index ¶
- Variables
- type AuthenticateRequest
- type AuthenticateResponse
- type CreateUserRequest
- type CreateUserResponse
- type DeleteUserRequest
- type DeleteUserResponse
- type NewUser
- type QueryUserByEmailRequest
- type QueryUserByEmailResponse
- type QueryUserByIDRequest
- type QueryUserByIDResponse
- type QueryUserRequest
- type QueryUserResponse
- type Role
- type Storer
- type UpdateUser
- type UpdateUserRequest
- type UpdateUserResponse
- type User
- type UserRpcService
- type UserService
- type UserServicer
- func (u UserServicer) Authenticate(req AuthenticateRequest, gr server.GenericRequest) AuthenticateResponse
- func (h UserServicer) AuthenticateHandler(r server.GenericRequest, b []byte) (any, error)
- func (u UserServicer) CreateUser(req CreateUserRequest, gr server.GenericRequest) CreateUserResponse
- func (h UserServicer) CreateUserHandler(r server.GenericRequest, b []byte) (any, error)
- func (u UserServicer) DeleteUser(req DeleteUserRequest, gr server.GenericRequest) DeleteUserResponse
- func (h UserServicer) DeleteUserHandler(r server.GenericRequest, b []byte) (any, error)
- func (UserServicer) QueryUser(QueryUserRequest, server.GenericRequest) QueryUserResponse
- func (u UserServicer) QueryUserByEmail(req QueryUserByEmailRequest, gr server.GenericRequest) QueryUserByEmailResponse
- func (h UserServicer) QueryUserByEmailHandler(r server.GenericRequest, b []byte) (any, error)
- func (u UserServicer) QueryUserByID(req QueryUserByIDRequest, gr server.GenericRequest) QueryUserByIDResponse
- func (h UserServicer) QueryUserByIDHandler(r server.GenericRequest, b []byte) (any, error)
- func (h UserServicer) QueryUserHandler(r server.GenericRequest, b []byte) (any, error)
- func (us UserServicer) Register(s *server.Server)
- func (u UserServicer) UpdateUser(req UpdateUserRequest, gr server.GenericRequest) UpdateUserResponse
- func (h UserServicer) UpdateUserHandler(r server.GenericRequest, b []byte) (any, error)
Constants ¶
This section is empty.
Variables ¶
var ( RoleAdmin = Role{"ADMIN"} RoleUser = Role{"USER"} )
Set of possible roles for a user.
Functions ¶
This section is empty.
Types ¶
type AuthenticateRequest ¶
type AuthenticateResponse ¶
type CreateUserRequest ¶
type CreateUserRequest struct {
NewUser NewUser `json:"newUser"`
}
CreateUserRequest is the request object for UserService.CreateUser.
type CreateUserResponse ¶
CreateUserResponse is the response object containing a UserService.CreateUser.
type DeleteUserRequest ¶
type DeleteUserRequest struct {
User User `json:"user"`
}
DeleteUserRequest is the request object for UserService.DeleteUser.
type DeleteUserResponse ¶
DeleteUserResponse is the response object for UserService.DeleteUser.
type NewUser ¶
type NewUser struct { Name string `json:"name"` Email mail.Address `json:"email"` Roles []Role `json:"roles"` Department string `json:"department"` Password string `json:"password"` PasswordConfirm string `json:"password_confirm"` }
NewUser contains information needed to create a new user.
type QueryUserByEmailRequest ¶
type QueryUserByEmailRequest struct {
Email string `json:"email"`
}
QueryUserByEmailRequest is the request object for UserService.QueryUserByEmail.
type QueryUserByEmailResponse ¶
type QueryUserByEmailResponse struct { User User `json:"user"` Error string `json:"error,omitempty"` }
QueryUserByEmailResponse is the response object for UserService.QueryUserByEmail.
type QueryUserByIDRequest ¶
type QueryUserByIDRequest struct {
ID string `json:"id"`
}
QueryUserByIDRequest is the request object for UserService.QueryUserByID.
type QueryUserByIDResponse ¶
QueryUserByIDResponse is the response object for UserService.QueryUserByID.
type QueryUserRequest ¶
type QueryUserRequest struct{}
type QueryUserResponse ¶
type QueryUserResponse struct{}
type Role ¶
type Role struct {
// contains filtered or unexported fields
}
Role represents a role in the system.
func MustParseRole ¶
MustParseRole parses the string value and returns a role if one exists. If an error occurs the function panics.
func (Role) MarshalText ¶
MarshalText implement the marshal interface for JSON conversions.
func (*Role) UnmarshalText ¶
UnmarshalText implement the unmarshal interface for JSON conversions.
type Storer ¶
type Storer interface { Create(ctx context.Context, usr User) (User, error) Delete(ctx context.Context, email mail.Address) (User, error) QueryByID(ctx context.Context, id string) (User, error) QueryByEmail(ctx context.Context, email string) (User, error) Update(ctx context.Context, usr UpdateUser) (User, error) Authenticate(ctx context.Context, email string, password string) (User, error) }
Storer interface declares the behavior this package needs to perists and retrieve data.
type UpdateUser ¶
type UpdateUser struct { Name *string `json:"name"` Email *mail.Address `json:"email"` Roles []Role `json:"roles"` Department *string `json:"department"` Password *string `json:"passowrd"` PasswordConfirm *string `json:"password_confirm"` Enabled *bool `json:"enabled"` }
UpdateUser contains information needed to update a user.
type UpdateUserRequest ¶
type UpdateUserRequest struct {
UpdateUser UpdateUser `json:"user"`
}
type UpdateUserResponse ¶
type User ¶
type User struct { ID uuid.UUID `json:"id"` Name string `json:"name"` Email mail.Address `json:"email"` Roles []Role `json:"roles"` PasswordHash []byte `json:"password_hash"` Department string `json:"department"` Enabled bool `json:"enabled"` DateCreated time.Time `json:"date_created"` DateUpdated time.Time `json:"date_updated"` }
User represents information about an individual user.
type UserRpcService ¶
type UserRpcService interface { UserService // Registers RPCService with Server Register(s *server.Server) }
Required to register endpoints with the Server
func NewUserServicer ¶
func NewUserServicer(log *zap.SugaredLogger, storer Storer, a auth.Auth) UserRpcService
Create new UserServicer
type UserService ¶
type UserService interface { // CreateUser create a user CreateUser(CreateUserRequest, server.GenericRequest) CreateUserResponse // UpdateUser updates a user UpdateUser(UpdateUserRequest, server.GenericRequest) UpdateUserResponse // DeleteUser deletes a user DeleteUser(DeleteUserRequest, server.GenericRequest) DeleteUserResponse // QueryUser retrieves a list of existing users QueryUser(QueryUserRequest, server.GenericRequest) QueryUserResponse // QueryByID gets the specified user by id QueryUserByID(QueryUserByIDRequest, server.GenericRequest) QueryUserByIDResponse // QueryByEmail gets the specified user by email QueryUserByEmail(QueryUserByEmailRequest, server.GenericRequest) QueryUserByEmailResponse // Authenticate finds a user by their email and verifies their password. On // success it returns a Claims User representing this user. The claims can be // used to generate a token for future authentication. Authenticate(AuthenticateRequest, server.GenericRequest) AuthenticateResponse }
UserService is an API for creating users for an app.
type UserServicer ¶
type UserServicer struct {
// contains filtered or unexported fields
}
Implements interface
func (UserServicer) Authenticate ¶
func (u UserServicer) Authenticate(req AuthenticateRequest, gr server.GenericRequest) AuthenticateResponse
Authenticate implements UserRpcService
func (UserServicer) AuthenticateHandler ¶
func (h UserServicer) AuthenticateHandler(r server.GenericRequest, b []byte) (any, error)
AuthenticateHandler validates input data prior to calling Authenticate
func (UserServicer) CreateUser ¶
func (u UserServicer) CreateUser(req CreateUserRequest, gr server.GenericRequest) CreateUserResponse
CreateUser implements UserRpcService
func (UserServicer) CreateUserHandler ¶
func (h UserServicer) CreateUserHandler(r server.GenericRequest, b []byte) (any, error)
CreateUserHandler validates input data prior to calling CreateUser
func (UserServicer) DeleteUser ¶
func (u UserServicer) DeleteUser(req DeleteUserRequest, gr server.GenericRequest) DeleteUserResponse
DeleteUser implements UserRpcService
func (UserServicer) DeleteUserHandler ¶
func (h UserServicer) DeleteUserHandler(r server.GenericRequest, b []byte) (any, error)
DeleteUserHandler validates input data prior to calling DeleteUser
func (UserServicer) QueryUser ¶
func (UserServicer) QueryUser(QueryUserRequest, server.GenericRequest) QueryUserResponse
QueryUser implements UserRpcService
func (UserServicer) QueryUserByEmail ¶
func (u UserServicer) QueryUserByEmail(req QueryUserByEmailRequest, gr server.GenericRequest) QueryUserByEmailResponse
QueryUserByEmail implements UserRpcService
func (UserServicer) QueryUserByEmailHandler ¶
func (h UserServicer) QueryUserByEmailHandler(r server.GenericRequest, b []byte) (any, error)
QueryUserByEmailHandler validates input data prior to calling QueryUserByEmail
func (UserServicer) QueryUserByID ¶
func (u UserServicer) QueryUserByID(req QueryUserByIDRequest, gr server.GenericRequest) QueryUserByIDResponse
QueryUserByID implements UserRpcService
func (UserServicer) QueryUserByIDHandler ¶
func (h UserServicer) QueryUserByIDHandler(r server.GenericRequest, b []byte) (any, error)
QueryUserByIDHandler validates input data prior to calling QueryUserByID
func (UserServicer) QueryUserHandler ¶
func (h UserServicer) QueryUserHandler(r server.GenericRequest, b []byte) (any, error)
QueryUserHandler validates input data prior to calling QueryUser
func (UserServicer) Register ¶
func (us UserServicer) Register(s *server.Server)
Register implements UserRpcService
func (UserServicer) UpdateUser ¶
func (u UserServicer) UpdateUser(req UpdateUserRequest, gr server.GenericRequest) UpdateUserResponse
UpdateUser implements UserRpcService
func (UserServicer) UpdateUserHandler ¶
func (h UserServicer) UpdateUserHandler(r server.GenericRequest, b []byte) (any, error)
UpdateUserHandler validates input data prior to calling UpdateUser