Documentation ¶
Index ¶
- func Exists[T any](conds ...any) bool
- func GetBranches(platform, mid string, r *[]Post)
- func GetPosts(begin, end string, r *[]Post)
- func HasPost(platform, mid string) bool
- func ParseStruct(in any) []string
- func Preload[T any](t *T, conds ...any) error
- func PreloadDB(in any) (r *gorm.DB)
- func Preloads[T any](t *[]T, conds ...any) error
- func Public() resource.Explorer
- func Save(url string) string
- func SavePost(p *Post)
- func SavePosts(p ...*Post)
- func SetDB(r *gorm.DB) *gorm.DB
- func SetDialector(dialector gorm.Dialector) *gorm.DB
- func SetPublic(name string, r resource.Explorer)
- func SetSqlite(file string) *gorm.DB
- func Update(x any, conds ...any) bool
- type Attachment
- func (a *Attachment) BeforeCreate(tx *gorm.DB) error
- func (a *Attachment) Download() error
- func (a *Attachment) Downloaded() bool
- func (a Attachment) MarshalJSON() ([]byte, error)
- func (a *Attachment) Path() string
- func (a *Attachment) Saved() bool
- func (a *Attachment) Store(data []byte)
- func (a Attachment) String() string
- type Attachments
- type Blogger
- type Model
- type Monitor
- type Post
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseStruct ¶
Types ¶
type Attachment ¶
type Attachment struct { Model // 原网址 Url string `form:"url" gorm:"unique" cmps:"1"` // 本地路径 Local string // 同浏览器 MIME type 附件的媒体类型 MIME string }
附件
func (*Attachment) BeforeCreate ¶
func (a *Attachment) BeforeCreate(tx *gorm.DB) error
func (*Attachment) Downloaded ¶
func (a *Attachment) Downloaded() bool
func (Attachment) MarshalJSON ¶
func (a Attachment) MarshalJSON() ([]byte, error)
func (*Attachment) Path ¶
func (a *Attachment) Path() string
func (*Attachment) Saved ¶
func (a *Attachment) Saved() bool
func (*Attachment) Store ¶
func (a *Attachment) Store(data []byte)
func (Attachment) String ¶
func (a Attachment) String() string
type Attachments ¶
type Attachments []Attachment
附件合集
func (*Attachments) Add ¶
func (as *Attachments) Add(urls ...string)
func (Attachments) String ¶
func (as Attachments) String() string
func (Attachments) Urls ¶
func (as Attachments) Urls() string
type Blogger ¶
type Blogger struct { Model Platform string `form:"platform" json:"platform"` Uid string `form:"uid" json:"uid" cmps:"1"` Create string `form:"create" json:"create"` Name string `form:"name" json:"name"` Description string `form:"description" json:"description"` Follower string `form:"follower" json:"follower"` Following string `form:"following" json:"following"` FaceID int64 `gorm:"column:face" json:"-"` Face Attachment `form:"face" json:"face" preload:"1"` PendantID int64 `gorm:"column:pendant" json:"-"` Pendant Attachment `form:"pendant" json:"pendant" preload:"2"` }
博主信息部分
type Post ¶
type Post struct { Model // 平台 Platform string `form:"platform" json:"platform"` // 博文序号 Mid string `form:"mid" json:"mid"` // 发送时间 Time string `form:"time" json:"time"` // 文本 Text string `form:"text" json:"text"` // 内容 Content string `gorm:"-" form:"-" json:"-"` // 来源 Source string `form:"source" json:"source"` // 博主 BloggerID string `form:"-" json:"-" gorm:"column:blogger"` Blogger Blogger `form:"blogger" json:"blogger" preload:""` // 回复 RepostID *uint64 `form:"-" json:"-" gorm:"column:repost"` Repost *Post `form:"repost" json:"repost"` // 评论 CommentID *uint64 `form:"-" json:"-" gorm:"column:comment"` Comments []Post `form:"comments" json:"comments" gorm:"foreignKey:CommentID"` // 附件 Attachments Attachments `form:"attachments" json:"attachments" gorm:"many2many:post_attachments;"` // 提交者 Submitter *user.User `form:"-" json:"submitter"` // 编辑距离 Distance int `gorm:"-" form:"-" json:"-" cmps:"1"` // 替换器 Replacer *strings.Replacer `gorm:"-" form:"-" json:"-"` }
博文或评论
Click to show internal directories.
Click to hide internal directories.