Documentation
¶
Index ¶
- func WithWriter(ctx context.Context) context.Context
- type ArchivePeriod
- type CommentQuery
- type CommentService
- func (s *CommentService) ByID(ctx context.Context, id int64) (models.Comment, error)
- func (s *CommentService) ClearSpam(ctx context.Context) error
- func (s *CommentService) CountFiltered(ctx context.Context, query CommentQuery) (int64, error)
- func (s *CommentService) CountForContent(ctx context.Context, cid int64) (int64, error)
- func (s *CommentService) CountRecentByIP(ctx context.Context, ip string, since int64) (int64, error)
- func (s *CommentService) CountRecentByIPForContent(ctx context.Context, cid int64, ip string, since int64) (int64, error)
- func (s *CommentService) Delete(ctx context.Context, id int64) error
- func (s *CommentService) DeleteMany(ctx context.Context, ids []int64) error
- func (s *CommentService) ExistsByURLType(ctx context.Context, cid int64, commentURL, typ string) (bool, error)
- func (s *CommentService) HasApprovedAuthor(ctx context.Context, author, mail string) (bool, error)
- func (s *CommentService) List(ctx context.Context, status, keywords string, cid int64) ([]models.Comment, error)
- func (s *CommentService) ListCommentsPlugin(ctx context.Context, query plugin.PublicCommentQuery) ([]plugin.PublicComment, int64, error)
- func (s *CommentService) ListFiltered(ctx context.Context, status, keywords string, cid int64, typ string) ([]models.Comment, error)
- func (s *CommentService) ListForContent(ctx context.Context, cid int64, order string, limit, offset int) ([]models.Comment, error)
- func (s *CommentService) ListForContentViewer(ctx context.Context, cid int64, order string, limit, offset int, ...) ([]models.Comment, error)
- func (s *CommentService) ListPage(ctx context.Context, query CommentQuery) ([]models.Comment, error)
- func (s *CommentService) Mark(ctx context.Context, id int64, status string) error
- func (s *CommentService) MarkMany(ctx context.Context, ids []int64, status string) error
- func (s *CommentService) NormalizeParent(ctx context.Context, cid, parent int64, maxDepth int) (int64, error)
- func (s *CommentService) ParentDepth(ctx context.Context, cid, parent int64) (int, error)
- func (s *CommentService) Save(ctx context.Context, input SaveCommentInput, id int64) error
- func (s *CommentService) SaveReturningID(ctx context.Context, input SaveCommentInput, id int64) (int64, error)
- type ContentQuery
- type ContentService
- func (s *ContentService) Adjacent(ctx context.Context, c models.Content) (prev, next models.Content, err error)
- func (s *ContentService) AllFields(ctx context.Context) ([]models.Field, error)
- func (s *ContentService) AllRelationships(ctx context.Context) ([]models.Relationship, error)
- func (s *ContentService) ArchiveMonths(ctx context.Context, loc *time.Location, limit int) ([]ArchivePeriod, error)
- func (s *ContentService) AttachmentBySlug(ctx context.Context, attachSlug string) (models.Content, error)
- func (s *ContentService) ByID(ctx context.Context, id int64) (models.Content, error)
- func (s *ContentService) BySlug(ctx context.Context, postSlug string) (models.Content, error)
- func (s *ContentService) CategoriesForContentIDs(ctx context.Context, cid int64) ([]int64, error)
- func (s *ContentService) Count(ctx context.Context) (int64, error)
- func (s *ContentService) CountList(ctx context.Context, q ContentQuery) (int64, error)
- func (s *ContentService) Create(ctx context.Context, input SaveContentInput, authorID int64) (int64, error)
- func (s *ContentService) CreateAttachment(ctx context.Context, title, slugValue, filePath string, authorID, parent int64) (int64, error)
- func (s *ContentService) CreateAttachmentMeta(ctx context.Context, title, slugValue, text string, authorID, parent int64) (int64, error)
- func (s *ContentService) DB() *sql.DB
- func (s *ContentService) Delete(ctx context.Context, id int64) error
- func (s *ContentService) DeleteDraft(ctx context.Context, draftID int64) error
- func (s *ContentService) DeleteField(ctx context.Context, cid int64, name string) error
- func (s *ContentService) DeleteRevision(ctx context.Context, cid, rid int64) error
- func (s *ContentService) Dialect() models.Dialect
- func (s *ContentService) DraftForContent(ctx context.Context, contentID int64) (models.Content, error)
- func (s *ContentService) DraftMapForContents(ctx context.Context, contentIDs []int64) (map[int64]bool, error)
- func (s *ContentService) FieldMap(ctx context.Context, cid int64) (map[string]any, error)
- func (s *ContentService) FieldMapsForContents(ctx context.Context, cids []int64) (map[int64]map[string]any, error)
- func (s *ContentService) FieldsForContent(ctx context.Context, cid int64) ([]models.Field, error)
- func (s *ContentService) IncrementFieldInt(ctx context.Context, cid int64, name string, delta int64) (int64, error)
- func (s *ContentService) List(ctx context.Context, q ContentQuery) ([]models.Content, error)
- func (s *ContentService) ListAll(ctx context.Context, limit, offset int) ([]models.Content, error)
- func (s *ContentService) ListContentsPlugin(ctx context.Context, query plugin.PublicContentQuery) ([]plugin.PublicContent, int64, error)
- func (s *ContentService) ListPublished(ctx context.Context, limit, offset int) ([]models.Content, error)
- func (s *ContentService) MarkStatus(ctx context.Context, id int64, status string) error
- func (s *ContentService) MetaIDsForContent(ctx context.Context, cid int64) ([]int64, error)
- func (s *ContentService) PageBySlug(ctx context.Context, pageSlug string) (models.Content, error)
- func (s *ContentService) PrivateBySlugForAuthor(ctx context.Context, contentSlug, typ string, authorID int64) (models.Content, error)
- func (s *ContentService) PruneEditingDrafts(ctx context.Context, publishedID, keepID int64) error
- func (s *ContentService) PublishDraft(ctx context.Context, draftID int64) error
- func (s *ContentService) RepairOrphanEditingDrafts(ctx context.Context) error
- func (s *ContentService) RestoreRevision(ctx context.Context, cid, rid int64) (int64, error)
- func (s *ContentService) RevisionByID(ctx context.Context, rid int64) (models.Revision, error)
- func (s *ContentService) Revisions(ctx context.Context, cid int64) ([]models.Revision, error)
- func (s *ContentService) SaveEditingDraft(ctx context.Context, publishedID int64, input SaveContentInput, authorID int64) (int64, error)
- func (s *ContentService) SaveFields(ctx context.Context, cid int64, fields []SaveFieldInput) error
- func (s *ContentService) SaveRevision(ctx context.Context, c models.Content) error
- func (s *ContentService) SetField(ctx context.Context, cid int64, field SaveFieldInput) error
- func (s *ContentService) SetRevisionConfig(enabled bool, limit int)
- func (s *ContentService) SetRevisionLimit(limit int)
- func (s *ContentService) Stats(ctx context.Context) (models.Stats, error)
- func (s *ContentService) TagsForContentNames(ctx context.Context, cid int64) ([]string, error)
- func (s *ContentService) Update(ctx context.Context, id int64, input SaveContentInput) error
- func (s *ContentService) UpdateAttachmentMeta(ctx context.Context, id int64, title, slugValue, text string, parent int64) error
- type DB
- type DBRouter
- func (r *DBRouter) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
- func (r *DBRouter) Dialect() models.Dialect
- func (r *DBRouter) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (r *DBRouter) PingContext(ctx context.Context) error
- func (r *DBRouter) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (r *DBRouter) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
- func (r *DBRouter) RawWriter() *sql.DB
- type MetaService
- func (s *MetaService) ByID(ctx context.Context, id int64) (models.Meta, error)
- func (s *MetaService) BySlug(ctx context.Context, typ, slug string) (models.Meta, error)
- func (s *MetaService) CategoriesForContent(ctx context.Context, cid int64) ([]models.Meta, error)
- func (s *MetaService) CleanOrphanTags(ctx context.Context) (int64, error)
- func (s *MetaService) CountFiltered(ctx context.Context, query plugin.PublicMetaQuery) (int64, error)
- func (s *MetaService) Delete(ctx context.Context, id int64) error
- func (s *MetaService) EnsureDefaultCategory(ctx context.Context) error
- func (s *MetaService) List(ctx context.Context, typ string) ([]models.Meta, error)
- func (s *MetaService) ListCloud(ctx context.Context, typ string, limit int) ([]models.Meta, error)
- func (s *MetaService) ListFiltered(ctx context.Context, query plugin.PublicMetaQuery) ([]models.Meta, error)
- func (s *MetaService) ListMetasPlugin(ctx context.Context, query plugin.PublicMetaQuery) ([]plugin.PublicMeta, int64, error)
- func (s *MetaService) Merge(ctx context.Context, targetID int64, sourceIDs []int64, typ string) error
- func (s *MetaService) Move(ctx context.Context, id int64, direction string) error
- func (s *MetaService) RefreshCount(ctx context.Context, id int64) error
- func (s *MetaService) RefreshCounts(ctx context.Context) error
- func (s *MetaService) Save(ctx context.Context, input SaveMetaInput, id int64) (int64, error)
- func (s *MetaService) SetDefaultCategory(ctx context.Context, mid int64, options *OptionService) error
- func (s *MetaService) TagsForContent(ctx context.Context, cid int64) ([]models.Meta, error)
- type OptionService
- func (s *OptionService) All(ctx context.Context) (map[string]string, error)
- func (s *OptionService) EnsureDefaults(ctx context.Context) error
- func (s *OptionService) Get(ctx context.Context, name string) (string, error)
- func (s *OptionService) GetForUser(ctx context.Context, name string, userID int64) (string, error)
- func (s *OptionService) Set(ctx context.Context, name, value string) error
- func (s *OptionService) SetForUser(ctx context.Context, name, value string, userID int64) error
- type SQLDB
- func (d *SQLDB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
- func (d *SQLDB) Dialect() models.Dialect
- func (d *SQLDB) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (d *SQLDB) PingContext(ctx context.Context) error
- func (d *SQLDB) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (d *SQLDB) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
- func (d *SQLDB) RawWriter() *sql.DB
- type SaveCommentInput
- type SaveContentInput
- type SaveFieldInput
- type SaveMetaInput
- type SaveUserInput
- type UserService
- func (s *UserService) Authenticate(ctx context.Context, name, password string) (models.User, error)
- func (s *UserService) ByID(ctx context.Context, id int64) (models.User, error)
- func (s *UserService) ByMail(ctx context.Context, mail string) (models.User, error)
- func (s *UserService) ByName(ctx context.Context, name string) (models.User, error)
- func (s *UserService) ChangePassword(ctx context.Context, id int64, password string) error
- func (s *UserService) Count(ctx context.Context) (int, error)
- func (s *UserService) CountFiltered(ctx context.Context, query plugin.PublicUserQuery) (int64, error)
- func (s *UserService) Delete(ctx context.Context, id int64) error
- func (s *UserService) EnsureDefaultAdmin(ctx context.Context, name, password, mail string) error
- func (s *UserService) ExistsMail(ctx context.Context, mail string, exceptID int64) (bool, error)
- func (s *UserService) ExistsName(ctx context.Context, name string, exceptID int64) (bool, error)
- func (s *UserService) List(ctx context.Context, keywords string) ([]models.User, error)
- func (s *UserService) ListFiltered(ctx context.Context, query plugin.PublicUserQuery) ([]models.User, error)
- func (s *UserService) ListUsersPlugin(ctx context.Context, query plugin.PublicUserQuery) ([]plugin.PublicUser, int64, error)
- func (s *UserService) RevokeSessions(ctx context.Context, id int64) error
- func (s *UserService) Save(ctx context.Context, input SaveUserInput, id int64) (int64, error)
- func (s *UserService) TouchLogged(ctx context.Context, id int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommentQuery ¶
type CommentService ¶
type CommentService struct {
// contains filtered or unexported fields
}
func NewCommentService ¶
func NewCommentService(db DB) *CommentService
func (*CommentService) CountFiltered ¶
func (s *CommentService) CountFiltered(ctx context.Context, query CommentQuery) (int64, error)
func (*CommentService) CountForContent ¶
func (*CommentService) CountRecentByIP ¶
func (*CommentService) CountRecentByIPForContent ¶
func (*CommentService) Delete ¶
func (s *CommentService) Delete(ctx context.Context, id int64) error
func (*CommentService) DeleteMany ¶
func (s *CommentService) DeleteMany(ctx context.Context, ids []int64) error
func (*CommentService) ExistsByURLType ¶
func (*CommentService) HasApprovedAuthor ¶
func (*CommentService) ListCommentsPlugin ¶
func (s *CommentService) ListCommentsPlugin(ctx context.Context, query plugin.PublicCommentQuery) ([]plugin.PublicComment, int64, error)
func (*CommentService) ListFiltered ¶
func (*CommentService) ListForContent ¶
func (*CommentService) ListForContentViewer ¶
func (*CommentService) ListPage ¶
func (s *CommentService) ListPage(ctx context.Context, query CommentQuery) ([]models.Comment, error)
func (*CommentService) NormalizeParent ¶
func (*CommentService) ParentDepth ¶
func (*CommentService) Save ¶
func (s *CommentService) Save(ctx context.Context, input SaveCommentInput, id int64) error
func (*CommentService) SaveReturningID ¶
func (s *CommentService) SaveReturningID(ctx context.Context, input SaveCommentInput, id int64) (int64, error)
type ContentQuery ¶
type ContentService ¶
type ContentService struct {
// contains filtered or unexported fields
}
func NewContentService ¶
func NewContentService(db DB) *ContentService
func (*ContentService) AllRelationships ¶
func (s *ContentService) AllRelationships(ctx context.Context) ([]models.Relationship, error)
func (*ContentService) ArchiveMonths ¶
func (s *ContentService) ArchiveMonths(ctx context.Context, loc *time.Location, limit int) ([]ArchivePeriod, error)
func (*ContentService) AttachmentBySlug ¶
func (*ContentService) CategoriesForContentIDs ¶
CategoriesForContentIDs returns category IDs for a content item.
func (*ContentService) CountList ¶
func (s *ContentService) CountList(ctx context.Context, q ContentQuery) (int64, error)
func (*ContentService) Create ¶
func (s *ContentService) Create(ctx context.Context, input SaveContentInput, authorID int64) (int64, error)
func (*ContentService) CreateAttachment ¶
func (*ContentService) CreateAttachmentMeta ¶
func (*ContentService) DB ¶
func (s *ContentService) DB() *sql.DB
func (*ContentService) Delete ¶
func (s *ContentService) Delete(ctx context.Context, id int64) error
func (*ContentService) DeleteDraft ¶
func (s *ContentService) DeleteDraft(ctx context.Context, draftID int64) error
DeleteDraft deletes an editing draft (draftOf > 0) without affecting the published content.
func (*ContentService) DeleteField ¶
func (*ContentService) DeleteRevision ¶
func (s *ContentService) DeleteRevision(ctx context.Context, cid, rid int64) error
func (*ContentService) Dialect ¶
func (s *ContentService) Dialect() models.Dialect
func (*ContentService) DraftForContent ¶
func (s *ContentService) DraftForContent(ctx context.Context, contentID int64) (models.Content, error)
DraftForContent returns the editing draft for a given published content ID. Returns sql.ErrNoRows if no draft exists.
func (*ContentService) DraftMapForContents ¶
func (s *ContentService) DraftMapForContents(ctx context.Context, contentIDs []int64) (map[int64]bool, error)
DraftMapForContents returns a map of contentID -> true for published contents that have editing drafts.
func (*ContentService) FieldMapsForContents ¶
func (*ContentService) FieldsForContent ¶
func (*ContentService) IncrementFieldInt ¶
func (*ContentService) List ¶
func (s *ContentService) List(ctx context.Context, q ContentQuery) ([]models.Content, error)
func (*ContentService) ListContentsPlugin ¶
func (s *ContentService) ListContentsPlugin(ctx context.Context, query plugin.PublicContentQuery) ([]plugin.PublicContent, int64, error)
func (*ContentService) ListPublished ¶
func (*ContentService) MarkStatus ¶
func (*ContentService) MetaIDsForContent ¶
func (*ContentService) PageBySlug ¶
func (*ContentService) PrivateBySlugForAuthor ¶
func (*ContentService) PruneEditingDrafts ¶
func (s *ContentService) PruneEditingDrafts(ctx context.Context, publishedID, keepID int64) error
func (*ContentService) PublishDraft ¶
func (s *ContentService) PublishDraft(ctx context.Context, draftID int64) error
PublishDraft merges the editing draft content into the published article and deletes the draft.
func (*ContentService) RepairOrphanEditingDrafts ¶
func (s *ContentService) RepairOrphanEditingDrafts(ctx context.Context) error
func (*ContentService) RestoreRevision ¶
func (*ContentService) RevisionByID ¶
func (*ContentService) SaveEditingDraft ¶
func (s *ContentService) SaveEditingDraft(ctx context.Context, publishedID int64, input SaveContentInput, authorID int64) (int64, error)
func (*ContentService) SaveFields ¶
func (s *ContentService) SaveFields(ctx context.Context, cid int64, fields []SaveFieldInput) error
func (*ContentService) SaveRevision ¶
func (*ContentService) SetField ¶
func (s *ContentService) SetField(ctx context.Context, cid int64, field SaveFieldInput) error
func (*ContentService) SetRevisionConfig ¶
func (s *ContentService) SetRevisionConfig(enabled bool, limit int)
func (*ContentService) SetRevisionLimit ¶
func (s *ContentService) SetRevisionLimit(limit int)
func (*ContentService) TagsForContentNames ¶
TagsForContentNames returns tag names for a content item.
func (*ContentService) Update ¶
func (s *ContentService) Update(ctx context.Context, id int64, input SaveContentInput) error
func (*ContentService) UpdateAttachmentMeta ¶
type DB ¶
type DB interface {
QueryContext(context.Context, string, ...any) (*sql.Rows, error)
QueryRowContext(context.Context, string, ...any) *sql.Row
ExecContext(context.Context, string, ...any) (sql.Result, error)
BeginTx(context.Context, *sql.TxOptions) (*sql.Tx, error)
PingContext(context.Context) error
Dialect() models.Dialect
RawWriter() *sql.DB
}
type DBRouter ¶
func (*DBRouter) ExecContext ¶
func (*DBRouter) QueryContext ¶
func (*DBRouter) QueryRowContext ¶
type MetaService ¶
type MetaService struct {
// contains filtered or unexported fields
}
func NewMetaService ¶
func NewMetaService(db DB) *MetaService
func (*MetaService) CategoriesForContent ¶
func (*MetaService) CleanOrphanTags ¶
func (s *MetaService) CleanOrphanTags(ctx context.Context) (int64, error)
func (*MetaService) CountFiltered ¶
func (s *MetaService) CountFiltered(ctx context.Context, query plugin.PublicMetaQuery) (int64, error)
func (*MetaService) EnsureDefaultCategory ¶
func (s *MetaService) EnsureDefaultCategory(ctx context.Context) error
func (*MetaService) ListFiltered ¶
func (s *MetaService) ListFiltered(ctx context.Context, query plugin.PublicMetaQuery) ([]models.Meta, error)
func (*MetaService) ListMetasPlugin ¶
func (s *MetaService) ListMetasPlugin(ctx context.Context, query plugin.PublicMetaQuery) ([]plugin.PublicMeta, int64, error)
func (*MetaService) RefreshCount ¶
func (s *MetaService) RefreshCount(ctx context.Context, id int64) error
func (*MetaService) RefreshCounts ¶
func (s *MetaService) RefreshCounts(ctx context.Context) error
func (*MetaService) Save ¶
func (s *MetaService) Save(ctx context.Context, input SaveMetaInput, id int64) (int64, error)
func (*MetaService) SetDefaultCategory ¶
func (s *MetaService) SetDefaultCategory(ctx context.Context, mid int64, options *OptionService) error
func (*MetaService) TagsForContent ¶
type OptionService ¶
type OptionService struct {
// contains filtered or unexported fields
}
func NewOptionService ¶
func NewOptionService(db DB) *OptionService
func (*OptionService) EnsureDefaults ¶
func (s *OptionService) EnsureDefaults(ctx context.Context) error
func (*OptionService) GetForUser ¶
func (*OptionService) Set ¶
func (s *OptionService) Set(ctx context.Context, name, value string) error
func (*OptionService) SetForUser ¶
type SQLDB ¶
type SQLDB struct {
// contains filtered or unexported fields
}
func (*SQLDB) ExecContext ¶
func (*SQLDB) QueryContext ¶
func (*SQLDB) QueryRowContext ¶
type SaveCommentInput ¶
type SaveContentInput ¶
type SaveContentInput struct {
Title string
Slug string
SlugID int64
Text string
Type string
Status string
Password string
Created int64
SortOrder int64
Template string
Parent int64
AllowComment bool
AllowPing bool
AllowFeed bool
CategoryIDs []int64
Tags []string
Fields []SaveFieldInput
DraftOf int64
}
type SaveFieldInput ¶
type SaveMetaInput ¶
type SaveUserInput ¶
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(db DB) *UserService
func (*UserService) Authenticate ¶
func (*UserService) ChangePassword ¶
func (*UserService) CountFiltered ¶
func (s *UserService) CountFiltered(ctx context.Context, query plugin.PublicUserQuery) (int64, error)
func (*UserService) EnsureDefaultAdmin ¶
func (s *UserService) EnsureDefaultAdmin(ctx context.Context, name, password, mail string) error
func (*UserService) ExistsMail ¶
func (*UserService) ExistsName ¶
func (*UserService) ListFiltered ¶
func (s *UserService) ListFiltered(ctx context.Context, query plugin.PublicUserQuery) ([]models.User, error)
func (*UserService) ListUsersPlugin ¶
func (s *UserService) ListUsersPlugin(ctx context.Context, query plugin.PublicUserQuery) ([]plugin.PublicUser, int64, error)
func (*UserService) RevokeSessions ¶
func (s *UserService) RevokeSessions(ctx context.Context, id int64) error
func (*UserService) Save ¶
func (s *UserService) Save(ctx context.Context, input SaveUserInput, id int64) (int64, error)
func (*UserService) TouchLogged ¶
func (s *UserService) TouchLogged(ctx context.Context, id int64) error
Click to show internal directories.
Click to hide internal directories.