Documentation
¶
Index ¶
- Constants
- Variables
- type ActionType
- type AddPointRequest
- type AliyunOssRequest
- type AliyunOssResponse
- type Banner
- type BannerListResponse
- type BaseGroupInfoResponse
- type BaseUserDetailResponse
- type BaseUserInfoResponse
- type CommentResponse
- type EditUserProfileRequest
- type EmailLoginRequest
- type EmailVerificationCodeRequest
- type EthereumEip712SignatureNonceRequest
- type EthereumEip712SignatureRequest
- type GroupCreateParams
- type GroupListResponse
- type GroupResponse
- type GroupUserAddParams
- type PostCommentListRequest
- type PostCommentListResponse
- type PostCreateCommentRequest
- type PostCreateParamRequest
- type PostEditParamRequest
- type PostListRequest
- type PostListResponse
- type PostResponse
- type TopicCreateParamRequest
- type TopicResponse
- type UpdatePointRequest
- type UserInfoResponse
Constants ¶
View Source
const ( AuthActionLogin = ActionType("login") AuthActionRegister = ActionType("register") )
Variables ¶
View Source
var (
Banners []*Banner
)
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
type ActionType string
func (ActionType) String ¶
func (a ActionType) String() string
type AddPointRequest ¶
type AliyunOssRequest ¶
type AliyunOssResponse ¶
type BannerListResponse ¶
type BannerListResponse struct {
Banners []*Banner `json:"banners"`
}
func (*BannerListResponse) WithBanners ¶
func (b *BannerListResponse) WithBanners(banners []*Banner) *BannerListResponse
type BaseGroupInfoResponse ¶
type BaseGroupInfoResponse struct {
Uuid string `json:"uuid"`
Name string `json:"name"`
Description string `json:"description"`
}
func (BaseGroupInfoResponse) WithGroup ¶
func (b BaseGroupInfoResponse) WithGroup(group *model.Group) *BaseGroupInfoResponse
type BaseUserDetailResponse ¶
type BaseUserDetailResponse struct {
*BaseUserInfoResponse
Followed bool `json:"followed"`
Follower bool `json:"follower"`
}
func (*BaseUserDetailResponse) WithBaseInfoResponseUser ¶
func (b *BaseUserDetailResponse) WithBaseInfoResponseUser(user *BaseUserInfoResponse, follower, followed bool) *BaseUserDetailResponse
type BaseUserInfoResponse ¶
type BaseUserInfoResponse struct {
Uuid string `json:"uuid"`
NickName string `json:"nick_name"`
Avatar string `json:"avatar"`
}
func (*BaseUserInfoResponse) WithUser ¶
func (b *BaseUserInfoResponse) WithUser(user *model.User) *BaseUserInfoResponse
func (*BaseUserInfoResponse) WithUsers ¶
func (b *BaseUserInfoResponse) WithUsers(users []*model.User) []*BaseUserInfoResponse
type CommentResponse ¶
type CommentResponse struct {
UUID string `json:"uuid"`
PostID string `json:"post_id"`
ParentID string `json:"parent_id"`
Content string `json:"content"`
Creator *BaseUserInfoResponse `json:"creator"`
Likes uint `json:"likes"`
Liked bool `json:"liked"`
Comments uint `json:"comments"`
Replies []CommentResponse `json:"replies"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
func (*CommentResponse) WithComment ¶
type EditUserProfileRequest ¶
type EmailLoginRequest ¶
type EmailVerificationCodeRequest ¶
type EmailVerificationCodeRequest struct {
To string `json:"to" binding:"required,email"`
}
type EthereumEip712SignatureNonceRequest ¶
type EthereumEip712SignatureNonceRequest struct {
EthAddress string `json:"eth_address" binding:"required,hexString"`
}
type EthereumEip712SignatureRequest ¶
type EthereumEip712SignatureRequest struct {
TypedData string `json:"typedData" binding:"required,hexString"`
TypedDataHash string `json:"typedDataHash" binding:"required,hexString"`
Signature string `json:"signature" binding:"required,hexString"`
}
func (EthereumEip712SignatureRequest) GetTypedData ¶
func (e EthereumEip712SignatureRequest) GetTypedData() string
type GroupCreateParams ¶
type GroupListResponse ¶
type GroupListResponse struct {
List []*GroupResponse `json:"list"`
}
func (*GroupListResponse) WithGroups ¶
func (g *GroupListResponse) WithGroups(groups []*model.Group, users map[string]*model.User) *GroupListResponse
type GroupResponse ¶
type GroupResponse struct {
*BaseGroupInfoResponse
Logo string `json:"logo"`
BgLogo string `json:"bg_logo"`
Creator *BaseUserInfoResponse `json:"creator"`
IsPrivate bool `json:"is_private"`
Posts uint64 `json:"posts"`
Users uint64 `json:"users"`
CreatedAt string `json:"created_at"`
}
func (*GroupResponse) WithGroup ¶
func (g *GroupResponse) WithGroup(group *model.Group, baseUserInfo *BaseUserInfoResponse) *GroupResponse
type GroupUserAddParams ¶
type GroupUserAddParams struct {
UserID string `json:"user_id" binding:"required,userExists"`
}
type PostCommentListRequest ¶
type PostCommentListRequest struct {
pages.PageRequest
}
type PostCommentListResponse ¶
type PostCommentListResponse struct {
Comments []*CommentResponse `json:"comments"`
}
func (*PostCommentListResponse) WithComments ¶
type PostCreateCommentRequest ¶
type PostCreateCommentRequest struct {
Content string `json:"content" binding:"required"`
}
type PostCreateParamRequest ¶
type PostEditParamRequest ¶
type PostListRequest ¶
type PostListRequest struct {
pages.PageRequest
Orders string `json:"orders"`
}
func (PostListRequest) IsValidOrderParam ¶
func (p PostListRequest) IsValidOrderParam() bool
type PostListResponse ¶
type PostListResponse struct {
List []*PostResponse `json:"list"`
}
func (*PostListResponse) WithLikes ¶
func (p *PostListResponse) WithLikes(likes map[string]bool) *PostListResponse
根据传入查询的结果,来给返回的列表中的每个post添加是否被点赞
func (*PostListResponse) WithPosts ¶
func (p *PostListResponse) WithPosts(posts []*model.Post, users []*model.User, groups map[string]*model.Group) *PostListResponse
func (*PostListResponse) WithShares ¶
func (p *PostListResponse) WithShares(shares map[string]bool) *PostListResponse
type PostResponse ¶
type PostResponse struct {
UUID string `json:"uuid"`
Title string `json:"title"`
Content string `json:"content"`
Liked bool `json:"liked"`
Likes uint64 `json:"likes"`
Comments uint64 `json:"comments"`
Views uint64 `json:"views"`
Images []string `json:"images"`
Group *BaseGroupInfoResponse `json:"group"`
Creator *BaseUserInfoResponse `json:"creator"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
func (*PostResponse) WithLiked ¶
func (p *PostResponse) WithLiked(liked bool) *PostResponse
func (*PostResponse) WithPost ¶
func (p *PostResponse) WithPost(post *model.Post, user *model.User, group *model.Group) *PostResponse
func (*PostResponse) WithShared ¶
func (p *PostResponse) WithShared(shared bool) *PostResponse
type TopicCreateParamRequest ¶
type TopicCreateParamRequest struct {
Name string `json:"name" binding:"required,max=256"`
}
type TopicResponse ¶
type UpdatePointRequest ¶
type UserInfoResponse ¶
type UserInfoResponse struct {
BaseUserInfoResponse
Email string `json:"email"`
EthAddress string `json:"eth_address"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
func (*UserInfoResponse) WithUser ¶
func (u *UserInfoResponse) WithUser(user *model.User) *UserInfoResponse
Click to show internal directories.
Click to hide internal directories.