Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
func NewHandler(e *echo.Group, service InterfaceService) *handler
Types ¶
type CreateData ¶
func (CreateData) Validate ¶
func (r CreateData) Validate() interface{}
type DeleteData ¶
type DeleteData struct {
ID string `param:"id" json:"id"`
}
func (DeleteData) Validate ¶
func (r DeleteData) Validate() interface{}
type Email ¶
type Email struct {
ID string `gorm:"primaryKey;Column:id;type:varchar(45)" json:"id"`
CreatedAt time.Time `gorm:"Column:created_at;type:timestamptz;not null" json:"createdAt"`
UpdatedAt time.Time `gorm:"Column:updated_at;type:timestamptz;not null" json:"updatedAt"`
DeletedAt gorm.DeletedAt `gorm:"Column:deleted_at;type:timestamptz" json:"deletedAt"`
UserID string `gorm:"Column:user_id;type:varchar(45);not null" json:"userId"`
Email string `gorm:"Column:email;type:varchar(255);not null" json:"email"`
}
type InterfaceRepository ¶
type InterfaceRepository interface {
Create(CreateData) (User, error)
Read(context.Context, ReadData) (entity.PaginatorResponse, error)
Update(UpdateData) error
Delete(DeleteData) error
}
type InterfaceService ¶
type InterfaceService interface {
Create(CreateData) (User, error)
Read(context.Context, ReadData) (entity.PaginatorResponse, error)
Update(UpdateData) error
Delete(DeleteData) error
}
type ReadData ¶
type ReadData struct {
entity.PaginatorRequest
ID string `query:"id" json:"id"`
}
type Repository ¶
func NewRepository ¶
func NewRepository(timeLocation *time.Location, db *gorm.DB) *Repository
func (*Repository) Create ¶
func (r *Repository) Create(req CreateData) (User, error)
func (*Repository) Delete ¶
func (r *Repository) Delete(req DeleteData) error
func (*Repository) Read ¶
func (r *Repository) Read(ctx context.Context, req ReadData) (entity.PaginatorResponse, error)
func (*Repository) Update ¶
func (r *Repository) Update(req UpdateData) error
type Service ¶
type Service struct {
Repository InterfaceRepository
}
func NewService ¶
func NewService(repository InterfaceRepository) *Service
func (*Service) Delete ¶
func (s *Service) Delete(req DeleteData) error
func (*Service) Update ¶
func (s *Service) Update(req UpdateData) error
type UpdateData ¶
type UpdateData struct {
ID string `param:"id" json:"id"`
Name string `json:"name"`
Emails []string `json:"emails"`
}
func (UpdateData) Validate ¶
func (r UpdateData) Validate() interface{}
type User ¶
type User struct {
ID string `gorm:"primaryKey;Column:id;type:varchar(45)" json:"id"`
CreatedAt time.Time `gorm:"Column:created_at;type:timestamptz;not null" json:"createdAt"`
UpdatedAt time.Time `gorm:"Column:updated_at;type:timestamptz;not null" json:"updatedAt"`
DeletedAt gorm.DeletedAt `gorm:"Column:deleted_at;type:timestamptz" json:"deletedAt"`
Name string `gorm:"Column:name;type:varchar(255);not null" json:"name"`
Emails []Email `gorm:"foreignKey:UserID;references:ID" json:"emails"`
}
Click to show internal directories.
Click to hide internal directories.