Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct { ID uint64 `json:"id"` UserID uint64 `json:"user_id" db:"user_id"` PhotoID uint64 `json:"photo_id" db:"photo_id"` Message string `json:"message"` User User `json:"user"` Photo Photo `json:"photo"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` }
type CommentCreationRequest ¶
type CommentCreationRequest struct { Message string `json:"message" binding:"required"` UserID uint64 `json:"user_id"` PhotoID uint64 `json:"photo_id" binding:"required"` }
func (CommentCreationRequest) ExistValidation ¶
func (ccr CommentCreationRequest) ExistValidation(db *sqlx.DB) error
type CommentUpdateRequest ¶
type CommentUpdateRequest struct {
Message string `json:"message"`
}
type Photo ¶
type Photo struct { ID uint64 `json:"id"` Title string `json:"title"` Caption string `json:"caption"` PhotoURL string `json:"photo_url" db:"photo_url"` UserID uint64 `json:"user_id" db:"user_id"` User User `json:"user"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` }
type PhotoCreationRequest ¶
type PhotoUpdateRequest ¶
type SocialMedia ¶
type SocialMedia struct { ID uint64 `json:"id"` Name string `json:"name"` SocialMediaURL string `json:"social_media_url" db:"social_media_url"` UserID uint64 `json:"user_id" db:"user_id"` User User `json:"user"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` }
type User ¶
type User struct { ID uint64 `json:"id"` Username string `json:"username"` Email string `json:"email"` Password string `json:"-"` Age int `json:"age"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` }
Model representation of data from database
func (User) VerifyPassword ¶
VerifyPassword checks whether the password given matches with the hashed one
type UserCreationRequest ¶
type UserCreationRequest struct { Username string `json:"username" binding:"required"` Email string `json:"email" binding:"required,email"` Password string `json:"password" binding:"required,min=6"` Age int `json:"age" binding:"required,min=9"` }
Struct for user registration request
func (UserCreationRequest) HashedPassword ¶
func (ucr UserCreationRequest) HashedPassword() string
HashedPassword returns bcrypt-hashed password in string
func (UserCreationRequest) UniqueValidation ¶
func (ucr UserCreationRequest) UniqueValidation(db *sqlx.DB) error
UniqueValidation makes sure the supplied fields is unique in the database
type UserLoginRequest ¶
type UserLoginRequest struct { Email string `json:"email" binding:"required,email"` Password string `json:"password" binding:"required"` }
Struct for user login request
type UserUpdateRequest ¶
type UserUpdateRequest struct { Username string `json:"username" binding:"required"` Email string `json:"email" binding:"required,email"` // contains filtered or unexported fields }
Struct for user update request
func (*UserUpdateRequest) SetUser ¶
func (uur *UserUpdateRequest) SetUser(user User)
SetUser sets user that is being updated to the struct
func (UserUpdateRequest) UniqueValidation ¶
func (uur UserUpdateRequest) UniqueValidation(db *sqlx.DB) error
UniqueValidation makes sure the supplied fields is unique in the database
Click to show internal directories.
Click to hide internal directories.