Documentation
¶
Index ¶
- Constants
- func ConvertToPageDto(page domain.Page[User]) *domain.Page[Dto]
- type ChangePasswordRequest
- type ConfirmEmailRequest
- type CreateRequest
- type CreateResponse
- type Dto
- type Gender
- type GenderDto
- type Option
- func Credentials(crd *security.Credentials) Option
- func DateOfBirth(dob time.Time) Option
- func Email(e string) Option
- func Enabled(e bool) Option
- func FullName(fn string) Option
- func Id(id uuid.UUID) Option
- func Location(l string) Option
- func Roles(roles ...*security.Role) Option
- func Sex(g Gender) Option
- type Request
- type RolesRequest
- type SignInRequest
- type SignInResponse
- type SignUpResponse
- type UpdateRequest
- type UpdateResponse
- type User
Constants ¶
View Source
const ( //TimeFormat1 to format date into TimeFormat1 = "2000-01-01" //TimeFormat2 Other format to format date time TimeFormat2 = "January 01, 2000" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChangePasswordRequest ¶
type ConfirmEmailRequest ¶
type CreateRequest ¶
type CreateResponse ¶
type CreateResponse struct {
Dto
}
type Dto ¶
type Dto struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Email string `validate:"required,min=3" json:"email"`
FullName string `json:"fullname"`
DateOfBirth time.Time `json:"dateOfBirth"`
Location string `json:"location"`
Gender GenderDto `json:"gender"`
Enabled bool `json:"enabled"`
}
UserDto represents user DTO.
func ConvertToDto ¶
ConvertToDto converts User entity into a User DTO.
type Option ¶
type Option func(*User)
func Credentials ¶
func Credentials(crd *security.Credentials) Option
func DateOfBirth ¶
type RolesRequest ¶
type SignInRequest ¶
type SignInResponse ¶
type SignInResponse struct {
Token string `json:"token"`
}
type SignUpResponse ¶
type SignUpResponse struct {
ID string `json:"id"`
}
type UpdateRequest ¶
type UpdateResponse ¶
type UpdateResponse struct {
Dto
}
type User ¶
type User struct {
bun.BaseModel `bun:"table:users,alias:u"`
domain.Entity
Email string `bun:"email,notnull,unique"`
FullName string `bun:"full_name,nullzero"`
DateOfBirth time.Time `bun:"date_of_birth,nullzero"`
Location string `bun:"location,nullzero"`
Gender Gender `bun:"gender,nullzero"`
Enabled bool `bun:"enabled"`
Credentials *security.Credentials `bun:"rel:has-one,join:id=user_id"`
Roles []*security.Role `bun:"rel:has-many,join:id=user_id"`
}
User represents database entity.
func ConvertToUser ¶
ConvertToUser converts User DTO into a User entity.
Click to show internal directories.
Click to hide internal directories.