handlers

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserGet = request.Handler(func(r *GetUserRequest) (*GetUserResponse, error) {
	return &GetUserResponse{
		User: r.User,
	}, nil
})
View Source
var UserList = request.Handler(func(r *ListUserRequest) (*ListUserResponse, error) {
	var users []*models.User
	var err error
	err = r.Read(func(tx *sqlx.Tx) error {
		users, err = models.UserQuery(r.Ctx).Get(tx)
		return err
	})
	if err != nil {
		return nil, err
	}
	return &ListUserResponse{
		Users: users,
	}, nil
})

Functions

This section is empty.

Types

type GetUserRequest added in v0.8.0

type GetUserRequest struct {
	User *models.User `inject:"id"`
}

type GetUserResponse added in v0.8.0

type GetUserResponse struct {
	User *models.User `json:"user"`
}

type ListUserRequest added in v0.8.0

type ListUserRequest struct {
	Read database.Read   `inject:""`
	Ctx  context.Context `inject:""`
}

type ListUserResponse added in v0.8.0

type ListUserResponse struct {
	Users []*models.User `json:"users"`
}

Jump to

Keyboard shortcuts

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