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=10"` 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=10"` Likes int64 `json:"likes" db:"likes" validate:"omitempty"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` }
Base Comment 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"` }
All News response
type News ¶
type News struct { NewsID uuid.UUID `json:"news_id" db:"news_id" validate:"omitempty,uuid"` AuthorID uuid.UUID `json:"author_id,omitempty" 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,omitempty" db:"created_at"` UpdatedAt time.Time `json:"updated_at,omitempty" 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"` }
All News response
type Role ¶
type Role struct { ID int `json:"id" db:"id" redis:"role_id" validate:"required"` Name string `json:"name" db:"name" redis:"role_name" validate:"omitempty,lte=30"` Description string `json:"description" db:"description" redis:"description"` ParentRoleId sql.NullInt64 `json:"parent_role_id" db:"parent_role_id" redis:"parent_role_id"` }
type Session ¶
type Session struct { SessionID string `json:"session_id" redis:"session_id"` UserID int `json:"user_id" redis:"user_id"` }
Session model
type UploadInput ¶
type UploadInput struct { File io.Reader Name string Size int64 ContentType string BucketName string }
AWS Upload Input
type User ¶
type User struct { ID int `json:"id" db:"id" redis:"user_id" validate:"required"` Username string `json:"username,omitempty" db:"username" redis:"username" validate:"omitempty,lte=60"` Email string `json:"email,omitempty" db:"email" redis:"email" validate:"omitempty,lte=60,email"` Password string `json:"password,omitempty" db:"password" redis:"password" validate:"omitempty,required"` CreatedAt time.Time `json:"created_at,omitempty" db:"created_at" redis:"created_at"` UpdatedAt time.Time `json:"updated_at,omitempty" db:"updated_at" redis:"updated_at"` LoginDate time.Time `json:"login_at" db:"login_at" redis:"login_at"` }
User full model
func (*User) ComparePasswords ¶
Compare user password and payload
type UserWithRole ¶
type UserWithToken ¶
Find user query
Click to show internal directories.
Click to hide internal directories.