Documentation
¶
Index ¶
- Constants
- func CreateHandler(svc UserService, w http.ResponseWriter, r *http.Request) error
- func DeleteHandler(svc UserService, w http.ResponseWriter, r *http.Request) error
- func GetHandler(svc UserService, w http.ResponseWriter, r *http.Request) error
- func ListHandler(svc UserService, w http.ResponseWriter, r *http.Request) error
- func UpdateHandler(svc UserService, w http.ResponseWriter, r *http.Request) error
- type UpdateUserSpec
- type UserListParamParser
- type UserService
- func (svc UserService) Create(ctx context.Context, userSpec UserSpec) (*UserSpec, error)
- func (svc UserService) DeleteByUserId(ctx context.Context, userId string) error
- func (svc UserService) GetByUserId(ctx context.Context, userId string) (*UserSpec, error)
- func (svc UserService) List(ctx context.Context, listParams service.ListParams) ([]UserSpec, error)
- func (svc UserService) Routes() ([]service.Route, error)
- func (svc UserService) UpdateByUserId(ctx context.Context, userId string, userSpec UpdateUserSpec) (*UserSpec, error)
- type UserSpec
Constants ¶
View Source
const ResourceTypeUser = "user"
Variables ¶
This section is empty.
Functions ¶
func CreateHandler ¶ added in v0.11.0
func CreateHandler(svc UserService, w http.ResponseWriter, r *http.Request) error
func DeleteHandler ¶ added in v0.11.0
func DeleteHandler(svc UserService, w http.ResponseWriter, r *http.Request) error
func GetHandler ¶ added in v0.11.0
func GetHandler(svc UserService, w http.ResponseWriter, r *http.Request) error
func ListHandler ¶ added in v0.11.0
func ListHandler(svc UserService, w http.ResponseWriter, r *http.Request) error
func UpdateHandler ¶ added in v0.11.0
func UpdateHandler(svc UserService, w http.ResponseWriter, r *http.Request) error
Types ¶
type UpdateUserSpec ¶
type UpdateUserSpec struct {
Email *string `json:"email"`
}
func (UpdateUserSpec) ToUpdateObjectSpec ¶ added in v0.36.0
func (updateSpec UpdateUserSpec) ToUpdateObjectSpec() *object.UpdateObjectSpec
type UserListParamParser ¶
type UserListParamParser struct{}
func (UserListParamParser) GetDefaultSortBy ¶
func (parser UserListParamParser) GetDefaultSortBy() string
func (UserListParamParser) GetSupportedSortBys ¶
func (parser UserListParamParser) GetSupportedSortBys() []string
func (UserListParamParser) ParseValue ¶
func (parser UserListParamParser) ParseValue(val string, sortBy string) (interface{}, error)
type UserService ¶
type UserService struct {
service.BaseService
EventSvc event.Service
ObjectSvc *object.ObjectService
}
func NewService ¶
func NewService(env service.Env, eventSvc event.Service, objectSvc *object.ObjectService) *UserService
func (UserService) DeleteByUserId ¶
func (svc UserService) DeleteByUserId(ctx context.Context, userId string) error
func (UserService) GetByUserId ¶
func (UserService) List ¶
func (svc UserService) List(ctx context.Context, listParams service.ListParams) ([]UserSpec, error)
func (UserService) Routes ¶ added in v0.8.0
func (svc UserService) Routes() ([]service.Route, error)
func (UserService) UpdateByUserId ¶
func (svc UserService) UpdateByUserId(ctx context.Context, userId string, userSpec UpdateUserSpec) (*UserSpec, error)
type UserSpec ¶
type UserSpec struct {
UserId string `json:"userId" validate:"omitempty,valid_object_id"`
Email *string `json:"email"`
CreatedAt time.Time `json:"createdAt"`
}
func NewUserSpecFromObjectSpec ¶ added in v0.36.0
func NewUserSpecFromObjectSpec(objectSpec *object.ObjectSpec) (*UserSpec, error)
func (UserSpec) ToCreateObjectSpec ¶ added in v0.34.0
func (spec UserSpec) ToCreateObjectSpec() (*object.CreateObjectSpec, error)
Click to show internal directories.
Click to hide internal directories.