Documentation ¶
Index ¶
- type Base
- type Comment
- type CommentCreateInput
- type CommentCreateInputSwagger
- type CommentCreateOutput
- type CommentGetOutput
- type CommentUpdateInput
- type CommentUpdateInputSwagger
- type CommentUpdateOutput
- type DeleteResponse
- type ErrorResponse
- type Photo
- type PhotoCreateInput
- type PhotoCreateInputSwagger
- type PhotoCreateOutput
- type PhotoGetOutput
- type PhotoUpdateInput
- type PhotoUpdateInputSwagger
- type PhotoUpdateOutput
- type SocialMedia
- type SocialMediaCreateInput
- type SocialMediaCreateInputSwagger
- type SocialMediaCreateOutput
- type SocialMediaGetOutput
- type SocialMediaUpdateInput
- type SocialMediaUpdateInputSwagger
- type SocialMediaUpdateOutput
- type User
- type UserLoginInput
- type UserLoginOutput
- type UserRegisterInput
- type UserRegisterOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type CommentCreateInput ¶
type CommentCreateInputSwagger ¶
type CommentCreateInputSwagger struct {
Message string `json:"message" form:"message"`
}
type CommentCreateOutput ¶
type CommentGetOutput ¶
type CommentGetOutput struct { Base Message string `json:"message"` User UserRegisterOutput `json:"user"` }
type CommentUpdateInput ¶
type CommentUpdateInputSwagger ¶
type CommentUpdateInputSwagger = CommentCreateInputSwagger
type CommentUpdateOutput ¶
type CommentUpdateOutput = CommentCreateOutput
type DeleteResponse ¶
type DeleteResponse struct {
Message string `json:"message"`
}
type ErrorResponse ¶
type Photo ¶
type PhotoCreateInput ¶
type PhotoCreateInputSwagger ¶
this struct only used for swagger docs to generate desired input
type PhotoCreateOutput ¶
type PhotoGetOutput ¶
type PhotoGetOutput struct { Base Title string `json:"title"` Caption string `json:"caption"` PhotoURL string `json:"photo_url"` User UserRegisterOutput `json:"user"` }
type PhotoUpdateInput ¶
type PhotoUpdateInput struct { ID uint `valid:"required~ID is required"` Title string `form:"title" valid:"required~title is required"` Caption string `form:"caption" valid:"required~caption is required"` PhotoURL string `form:"photo_url" valid:"required~photo URL is required"` UserID uint `valid:"required~user ID is required"` }
type PhotoUpdateInputSwagger ¶
type PhotoUpdateInputSwagger = PhotoCreateInputSwagger
type PhotoUpdateOutput ¶
type PhotoUpdateOutput = PhotoCreateOutput
type SocialMedia ¶
type SocialMedia struct { Base Name string `gorm:"not null"` SocialMediaURL string `gorm:"not null;uniqueIndex"` UserID uint User User }
func (*SocialMedia) BeforeCreate ¶
func (s *SocialMedia) BeforeCreate(tx *gorm.DB) (err error)
func (*SocialMedia) BeforeUpdate ¶
func (s *SocialMedia) BeforeUpdate(tx *gorm.DB) (err error)
type SocialMediaCreateInput ¶
type SocialMediaCreateOutput ¶
type SocialMediaGetOutput ¶
type SocialMediaGetOutput struct { Base Name string `json:"name" form:"name"` SocialMediaURL string `json:"social_media_url" form:"social_media_url"` User UserRegisterOutput `json:"user"` }
type SocialMediaUpdateInput ¶
type SocialMediaUpdateInput struct { ID uint `valid:"required~ID is required"` Name string `json:"name" form:"name" valid:"required~name is required"` SocialMediaURL string `json:"social_media_url" form:"social_media_url" valid:"required~social media URL is required"` UserID uint `valid:"required~user ID is required"` }
type SocialMediaUpdateInputSwagger ¶
type SocialMediaUpdateInputSwagger = SocialMediaCreateInputSwagger
type SocialMediaUpdateOutput ¶
type SocialMediaUpdateOutput = SocialMediaCreateOutput
type User ¶
type User struct { Base Username string `gorm:"not null;uniqueIndex"` Email string `gorm:"not null;uniqueIndex"` Password string `gorm:"not null"` Age int `gorm:"not null"` Photos []Photo `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"` Comments []Comment `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"` SocialMedias []SocialMedia `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"` }
type UserLoginInput ¶
type UserLoginOutput ¶
type UserLoginOutput struct {
Token string `json:"token"`
}
type UserRegisterInput ¶
type UserRegisterInput struct { Username string `json:"username" form:"username" valid:"required~username is required"` Email string `json:"email" form:"email" valid:"required~email is required,email~invalid email format"` Password string `` /* 140-byte string literal not displayed */ Age int `json:"age" form:"age" valid:"required~age is required,range(8|99)~user must be at least 8 years old"` }
Click to show internal directories.
Click to hide internal directories.