Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct { CommentID uuid.UUID `json:"comment_id" db:"comment_id" validate:"omitempty,uuid"` AuthorID uuid.UUID `json:"author_id" db:"author_id" validate:"required"` NewsID uuid.UUID `json:"news_id" db:"news_id" validate:"required"` Message string `json:"message" db:"message" validate:"required,gte=5"` Likes int64 `json:"likes" db:"likes" validate:"omitempty"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` }
Comment model
type CommentBase ¶
type CommentBase struct { CommentID uuid.UUID `json:"comment_id" db:"comment_id" validate:"omitempty,uuid"` AuthorID uuid.UUID `json:"author_id" db:"author_id" validate:"required"` Author string `json:"author" db:"author" validate:"required"` AvatarURL *string `json:"avatar_url" db:"avatar_url"` Message string `json:"message" db:"message" validate:"required,gte=5"` Likes int64 `json:"likes" db:"likes" validate:"omitempty"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` }
Comment base response
type CommentsList ¶
type CommentsList struct { TotalCount int `json:"total_count"` TotalPages int `json:"total_pages"` Page int `json:"page"` Size int `json:"size"` HasMore bool `json:"has_more"` Comments []*CommentBase `json:"comments"` }
Comment base list
type News ¶
type News struct { NewsID uuid.UUID `json:"news_id" db:"news_id" validate:"omitempty,uuid"` AuthorID uuid.UUID `json:"author_id" db:"author_id" validate:"required"` Title string `json:"title" db:"title" validate:"required,gte=10"` Content string `json:"content" db:"content" validate:"required,gte=20"` ImageURL *string `json:"image_url,omitempty" db:"image_url" validate:"omitempty,lte=512,url"` Category *string `json:"category,omitempty" db:"category" validate:"omitempty,lte=10"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` }
News base model
type NewsBase ¶
type NewsBase struct { NewsID uuid.UUID `json:"news_id" db:"news_id" validate:"omitempty,uuid"` AuthorID uuid.UUID `json:"author_id" db:"author_id" validate:"omitempty,uuid"` Title string `json:"title" db:"title" validate:"required,gte=10"` Content string `json:"content" db:"content" validate:"required,gte=20"` ImageURL *string `json:"image_url,omitempty" db:"image_url" validate:"omitempty,lte=512,url"` Category *string `json:"category,omitempty" db:"category" validate:"omitempty,lte=10"` Author string `json:"author" db:"author"` UpdatedAt time.Time `json:"updated_at,omitempty" db:"updated_at"` }
News base
type NewsList ¶
type NewsList struct { TotalCount int `json:"total_count"` TotalPages int `json:"total_pages"` Page int `json:"page"` Size int `json:"size"` HasMore bool `json:"has_more"` News []*News `json:"news"` }
News list response
type Session ¶
type Session struct { SessionID string `json:"session_id" redis:"session_id"` UserID uuid.UUID `json:"user_id" redis:"user_id"` }
Session model
type User ¶
type User struct { ID uuid.UUID `json:"user_id" db:"user_id" redis:"user_id" validate:"omitempty,uuid"` FirstName string `json:"first_name" db:"first_name" redis:"first_name" validate:"required_with,lte=30"` LastName string `json:"last_name" db:"last_name" redis:"last_name" validate:"required_with,lte=30"` Email string `json:"email" db:"email" redis:"email" validate:"omitempty,lte=60,email"` Password string `json:"password,omitempty" db:"password" redis:"password" validate:"required,gte=6"` Role *string `json:"role" db:"role" redis:"role" validate:"omitempty,lte=10"` Avatar *string `json:"avatar" db:"avatar" redis:"avatar"` PhoneNumber *string `json:"phone_number" db:"phone_number" redis:"phone_number" validate:"omitempty,lte=20"` Address *string `json:"address" db:"address" redis:"address" validate:"omitempty,lte=250"` City *string `json:"city" db:"city" redis:"city" validate:"omitempty,lte=24"` Country *string `json:"country" db:"country" redis:"country" validate:"omitempty,lte=24"` Postcode *int `json:"postcode" db:"postcode" redis:"postcode" validate:"omitempty,lte=10"` Balance float64 `json:"balance" db:"balance" redis:"balance"` CreatedAt time.Time `json:"created_at" db:"created_at" redis:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at" redis:"updated_at"` }
User model
func (*User) ComparePassword ¶
Compare user password and payload
type UserWithToken ¶
Find user query
Click to show internal directories.
Click to hide internal directories.