Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Post ¶
type Post struct {
ID int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
AuthorID int64 `json:"author_id"`
Status string `json:"status"`
Tags []string `json:"tags"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Post represents a blog post
type PostCreateRequest ¶
type PostCreateRequest struct {
Title string `json:"title" validate:"required,min=3,max=100"`
Content string `json:"content" validate:"required,min=10"`
Tags []string `json:"tags" validate:"dive,min=2,max=20"`
}
PostCreateRequest represents the request body for creating a new post
type PostResponse ¶
type PostResponse struct {
Post *Post `json:"post"`
Author *User `json:"author,omitempty"`
Message string `json:"message,omitempty"`
Status string `json:"status"`
Time time.Time `json:"time"`
}
PostResponse represents the response body for post operations
type PostUpdateRequest ¶
type PostUpdateRequest struct {
Title *string `json:"title,omitempty" validate:"omitempty,min=3,max=100"`
Content *string `json:"content,omitempty" validate:"omitempty,min=10"`
Status *string `json:"status,omitempty" validate:"omitempty,oneof=draft published archived"`
Tags *[]string `json:"tags,omitempty" validate:"omitempty,dive,min=2,max=20"`
}
PostUpdateRequest represents the request body for updating a post
type User ¶
type User struct {
ID int64 `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
Role string `json:"role"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
User represents a user in the system
type UserCreateRequest ¶
type UserCreateRequest struct {
Username string `json:"username" validate:"required,min=3,max=20"`
Email string `json:"email" validate:"required,email"`
Password string `json:"password" validate:"required,min=8"`
}
UserCreateRequest represents the request body for creating a new user
type UserResponse ¶
type UserResponse struct {
User *User `json:"user"`
Message string `json:"message,omitempty"`
Status string `json:"status"`
Time time.Time `json:"time"`
}
UserResponse represents the response body for user operations
type UserUpdateRequest ¶
type UserUpdateRequest struct {
Username *string `json:"username,omitempty" validate:"omitempty,min=3,max=20"`
Email *string `json:"email,omitempty" validate:"omitempty,email"`
Role *string `json:"role,omitempty" validate:"omitempty,oneof=admin user"`
}
UserUpdateRequest represents the request body for updating a user
Click to show internal directories.
Click to hide internal directories.