models

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatTimestamp

func FormatTimestamp(ts int64) time.Time

helper

Types

type AnswerAcceptReq

type AnswerAcceptReq struct {
	QuestionID string `json:"question_id"`
	AnswerID   string `json:"answer_id"`
}

type AnswerAddReq

type AnswerAddReq struct {
	QuestionID string `json:"question_id"`
	Content    string `json:"content"`
}

type AnswerDeleteReq

type AnswerDeleteReq struct {
	ID string `json:"id"`
}

type AnswerInfo

type AnswerInfo struct {
	ID           string         `json:"id"`
	QuestionID   string         `json:"question_id"`
	Content      string         `json:"content"`
	HTML         string         `json:"html"`
	VoteCount    int            `json:"vote_count"`
	CommentCount int            `json:"comment_count"`
	Accepted     int            `json:"accepted"`
	Status       int            `json:"status"`
	CreatedAt    int64          `json:"create_time"`
	UpdatedAt    int64          `json:"update_time"`
	UserInfo     *UserBasicInfo `json:"user_info"`
}

type AnswerListReq

type AnswerListReq struct {
	QuestionID string `json:"question_id"`
	Page       int    `json:"page"`
	PageSize   int    `json:"page_size"`
	Order      string `json:"order,omitempty"`
}

type AnswerListResp

type AnswerListResp struct {
	Count int64        `json:"count"`
	List  []AnswerInfo `json:"list"`
}

type AnswerUpdateReq

type AnswerUpdateReq struct {
	ID      string `json:"id"`
	Content string `json:"content"`
}

type AppConfig

type AppConfig struct {
	Version string `yaml:"version"`

	Server struct {
		BaseURL string `yaml:"base_url"`
		Token   string `yaml:"token"`
	} `yaml:"server"`

	AI struct {
		Provider    string  `yaml:"provider"`
		BaseURL     string  `yaml:"base_url"`
		ApiKey      string  `yaml:"api_key"`
		Model       string  `yaml:"model"`
		MaxTokens   int     `yaml:"max_tokens"`
		Temperature float64 `yaml:"temperature"`
		Timeout     int     `yaml:"timeout"`
	} `yaml:"ai"`

	Output struct {
		Format string `yaml:"format"`
	} `yaml:"output"`

	Log struct {
		Level      string `yaml:"level"`
		MaxSize    int    `yaml:"max_size"`
		MaxBackups int    `yaml:"max_backups"`
		MaxAge     int    `yaml:"max_age"`
		Compress   bool   `yaml:"compress"`
	} `yaml:"log"`
}

func (*AppConfig) GetAIAPIKey

func (c *AppConfig) GetAIAPIKey() string

func (*AppConfig) GetAIBaseURL

func (c *AppConfig) GetAIBaseURL() string

func (*AppConfig) GetAIModel

func (c *AppConfig) GetAIModel() string

func (*AppConfig) GetAIProvider

func (c *AppConfig) GetAIProvider() string

func (*AppConfig) GetOutputFormat

func (c *AppConfig) GetOutputFormat() string

func (*AppConfig) GetServerToken

func (c *AppConfig) GetServerToken() string

func (*AppConfig) GetServerURL

func (c *AppConfig) GetServerURL() string

type AvatarInfo

type AvatarInfo struct {
	Type     string `json:"type"`
	Gravatar string `json:"gravatar"`
	Custom   string `json:"custom"`
}

func (*AvatarInfo) GetURL

func (a *AvatarInfo) GetURL() string

func (*AvatarInfo) UnmarshalJSON

func (a *AvatarInfo) UnmarshalJSON(data []byte) error

type CommentAddReq

type CommentAddReq struct {
	ObjectID       string `json:"object_id"`
	OriginalText   string `json:"original_text"`
	ReplyCommentID string `json:"reply_comment_id,omitempty"`
}

type CommentDeleteReq

type CommentDeleteReq struct {
	CommentID string `json:"comment_id"`
}

type CommentInfo

type CommentInfo struct {
	CommentID            string `json:"comment_id"`
	ObjectID             string `json:"object_id"`
	QuestionID           string `json:"question_id"`
	ReplyUserID          string `json:"reply_user_id"`
	ReplyUsername        string `json:"reply_username"`
	ReplyUserDisplayName string `json:"reply_user_display_name"`
	ReplyCommentID       string `json:"reply_comment_id"`
	OriginalText         string `json:"original_text"`
	ParsedText           string `json:"parsed_text"`
	VoteCount            int    `json:"vote_count"`
	IsVote               bool   `json:"is_vote"`
	Status               int    `json:"status"`
	CreatedAt            int64  `json:"created_at"`
	UpdatedAt            int64  `json:"updated_at"`
	UserID               string `json:"user_id"`
	Username             string `json:"username"`
	UserDisplayName      string `json:"user_display_name"`
	UserAvatar           string `json:"user_avatar"`
	UserStatus           string `json:"user_status"`
}

func (CommentInfo) DisplayAuthor

func (c CommentInfo) DisplayAuthor() string

DisplayAuthor returns the best available display name.

type CommentListReq

type CommentListReq struct {
	ObjectID string `json:"object_id"`
	Page     int    `json:"page"`
	PageSize int    `json:"page_size"`
}

type CommentListResp

type CommentListResp struct {
	Count int64         `json:"count"`
	List  []CommentInfo `json:"list"`
}

type CommentUpdateReq

type CommentUpdateReq struct {
	CommentID    string `json:"comment_id"`
	OriginalText string `json:"original_text"`
}

type LoginResponse

type LoginResponse struct {
	AccessToken string          `json:"access_token"`
	ID          string          `json:"id"`
	Username    string          `json:"username"`
	EMail       string          `json:"e_mail"`
	DisplayName string          `json:"display_name"`
	Avatar      json.RawMessage `json:"avatar"`
	Rank        int             `json:"rank"`
}

type NotificationItem

type NotificationItem struct {
	ID        string `json:"id"`
	Type      string `json:"type"`
	IsRead    bool   `json:"is_read"`
	Title     string `json:"title"`
	Content   string `json:"content"`
	ObjectID  string `json:"object_id"`
	Reason    string `json:"reason"`
	CreatedAt int64  `json:"created_at"`
}

type NotificationListReq

type NotificationListReq struct {
	Page      int    `json:"page"`
	Size      int    `json:"size"`
	Type      string `json:"type,omitempty"`
	InboxType string `json:"inbox_type,omitempty"`
}

type NotificationListResp

type NotificationListResp struct {
	Count int64              `json:"count"`
	List  []NotificationItem `json:"list"`
}

type NotificationReadAllReq

type NotificationReadAllReq struct {
	Type string `json:"type,omitempty"`
}

type NotificationReadReq

type NotificationReadReq struct {
	ID string `json:"id"`
}

type NotificationStatusResp

type NotificationStatusResp struct {
	Inbox       bool `json:"inbox"`
	Achievement bool `json:"achievement"`
}

type PageModel

type PageModel struct {
	Count int64 `json:"count"`
	List  any   `json:"list"`
}

type QuestionAddReq

type QuestionAddReq struct {
	Title   string      `json:"title"`
	Content string      `json:"content"`
	Tags    []TagAddReq `json:"tags,omitempty"`
}

type QuestionCloseReq

type QuestionCloseReq struct {
	ID        string `json:"id"`
	CloseType int    `json:"close_type"`
	CloseMsg  string `json:"close_msg,omitempty"`
}

type QuestionDeleteReq

type QuestionDeleteReq struct {
	ID string `json:"id"`
}

type QuestionInfoResp

type QuestionInfoResp struct {
	ID               string         `json:"id"`
	Title            string         `json:"title"`
	Content          string         `json:"content"`
	HTML             string         `json:"html"`
	ViewCount        int            `json:"view_count"`
	UniqueViewCount  int            `json:"unique_view_count"`
	VoteCount        int            `json:"vote_count"`
	AnswerCount      int            `json:"answer_count"`
	CollectionCount  int            `json:"collection_count"`
	FollowCount      int            `json:"follow_count"`
	CommentCount     int            `json:"comment_count"`
	Status           int            `json:"status"`
	Pin              int            `json:"pin"`
	AcceptedAnswerID string         `json:"accepted_answer_id"`
	LastAnswerID     string         `json:"last_answer_id"`
	HotScore         int            `json:"hot_score"`
	CreatedAt        int64          `json:"create_time"`
	UpdatedAt        int64          `json:"update_time"`
	UserInfo         *UserBasicInfo `json:"user_info"`
	Tags             []TagItem      `json:"tags"`
}

type QuestionListItem

type QuestionListItem struct {
	ID               string         `json:"id"`
	Title            string         `json:"title"`
	Content          string         `json:"content"`
	ViewCount        int            `json:"view_count"`
	VoteCount        int            `json:"vote_count"`
	AnswerCount      int            `json:"answer_count"`
	CollectionCount  int            `json:"collection_count"`
	CommentCount     int            `json:"comment_count"`
	Status           int            `json:"status"`
	Pin              int            `json:"pin"`
	AcceptedAnswerID string         `json:"accepted_answer_id"`
	CreatedAt        int64          `json:"created_at"`
	UpdatedAt        int64          `json:"updated_at"`
	Operator         *UserBasicInfo `json:"operator"`
	Tags             []TagItem      `json:"tags"`
}

func (QuestionListItem) DisplayAuthor

func (q QuestionListItem) DisplayAuthor() string

type QuestionListReq

type QuestionListReq struct {
	Page     int    `json:"page"`
	PageSize int    `json:"page_size"`
	Order    string `json:"order,omitempty"`
	Tag      string `json:"tag,omitempty"`
	Username string `json:"username,omitempty"`
	InDays   int    `json:"in_days,omitempty"`
}

type QuestionPageResp

type QuestionPageResp struct {
	Count int64              `json:"count"`
	List  []QuestionListItem `json:"list"`
}

type QuestionReopenReq

type QuestionReopenReq struct {
	ID string `json:"id"`
}

type QuestionUpdateReq

type QuestionUpdateReq struct {
	ID      string   `json:"id"`
	Title   string   `json:"title"`
	Content string   `json:"content"`
	Tags    []string `json:"tags,omitempty"`
}

type SearchObject

type SearchObject struct {
	ID          string `json:"id"`
	QuestionID  string `json:"question_id"`
	Title       string `json:"title"`
	Excerpt     string `json:"excerpt"`
	VoteCount   int    `json:"vote_count"`
	AnswerCount int    `json:"answer_count"`
	Accepted    bool   `json:"accepted"`
	CreatedAt   int64  `json:"created_at"`
	StatusStr   string `json:"status"`
}

type SearchReq

type SearchReq struct {
	Query string `json:"q"`
	Page  int    `json:"page"`
	Size  int    `json:"size"`
	Order string `json:"order,omitempty"`
}

type SearchResp

type SearchResp struct {
	Count int64           `json:"count"`
	List  []*SearchResult `json:"list"`
}

type SearchResult

type SearchResult struct {
	ObjectType string        `json:"object_type"`
	Object     *SearchObject `json:"object"`
}

type TagAddReq

type TagAddReq struct {
	SlugName     string `json:"slug_name"`
	DisplayName  string `json:"display_name"`
	OriginalText string `json:"original_text,omitempty"`
}

type TagDeleteReq

type TagDeleteReq struct {
	SlugName string `json:"slug_name"`
}

type TagDetail

type TagDetail struct {
	ID              string `json:"id"`
	SlugName        string `json:"slug_name"`
	DisplayName     string `json:"display_name"`
	OriginalText    string `json:"original_text"`
	ParsedText      string `json:"parsed_text"`
	FollowCount     int    `json:"follow_count"`
	QuestionCount   int    `json:"question_count"`
	Status          int    `json:"status"`
	Recommend       bool   `json:"recommend"`
	Reserved        bool   `json:"reserved"`
	MainTagID       int64  `json:"main_tag_id"`
	MainTagSlugName string `json:"main_tag_slug_name"`
	CreatedAt       int64  `json:"created_at"`
}

type TagItem

type TagItem struct {
	ID          string `json:"id"`
	SlugName    string `json:"slug_name"`
	DisplayName string `json:"display_name"`
	MainTagID   int64  `json:"main_tag_id"`
	Reserved    bool   `json:"reserved"`
}

type TagListReq

type TagListReq struct {
	Page      int    `json:"page"`
	PageSize  int    `json:"page_size"`
	QueryCond string `json:"query_cond,omitempty"`
}

type TagListResp

type TagListResp struct {
	Count int64       `json:"count"`
	List  []TagDetail `json:"list"`
}

type TagUpdateReq

type TagUpdateReq struct {
	SlugName     string `json:"slug_name"`
	DisplayName  string `json:"display_name"`
	OriginalText string `json:"original_text,omitempty"`
}

type UserBasicInfo

type UserBasicInfo struct {
	ID          string      `json:"id"`
	Username    string      `json:"username"`
	DisplayName string      `json:"display_name"`
	Avatar      *AvatarInfo `json:"avatar"`
	Rank        int         `json:"rank"`
}

type UserDetailResp

type UserDetailResp struct {
	ID          string      `json:"id"`
	Username    string      `json:"username"`
	DisplayName string      `json:"display_name"`
	Avatar      *AvatarInfo `json:"avatar"`
	Rank        int         `json:"rank"`
	Bio         string      `json:"bio"`
	Website     string      `json:"website"`
	Location    string      `json:"location"`
}

UserDetailResp 用户详情

type UserInfoResp

type UserInfoResp struct {
	ID            string      `json:"id"`
	Username      string      `json:"username"`
	DisplayName   string      `json:"display_name"`
	EMail         string      `json:"e_mail"`
	Avatar        *AvatarInfo `json:"avatar"`
	Bio           string      `json:"bio"`
	Website       string      `json:"website"`
	Location      string      `json:"location"`
	Rank          int         `json:"rank"`
	AnswerCount   int         `json:"answer_count"`
	QuestionCount int         `json:"question_count"`
	FollowCount   int         `json:"follow_count"`
	IsAdmin       bool        `json:"is_admin"`
}

type VoteReq

type VoteReq struct {
	ObjectID string `json:"object_id"`
	Group    string `json:"group,omitempty"`
	IsCancel bool   `json:"is_cancel,omitempty"`
}

type VoteResp

type VoteResp struct {
	ID       string `json:"id"`
	ObjectID string `json:"object_id"`
	Group    string `json:"group"`
	Status   int    `json:"status"`
	UpDown   int    `json:"up_down"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL