Documentation
¶
Overview ¶
Package postgres provides the PostgreSQL data layer for the CMS core.
Index ¶
- Variables
- func Migrate(ctx context.Context, databaseURL string) error
- type PostStore
- func (s *PostStore) Autosave(ctx context.Context, postID, authorID uuid.UUID) (post.Revision, error)
- func (s *PostStore) ByID(ctx context.Context, id uuid.UUID) (post.Post, error)
- func (s *PostStore) Counts(ctx context.Context, postType string) (map[post.Status]int, error)
- func (s *PostStore) Create(ctx context.Context, p post.Post) (post.Post, error)
- func (s *PostStore) Delete(ctx context.Context, id uuid.UUID) error
- func (s *PostStore) DeleteAutosave(ctx context.Context, postID, authorID uuid.UUID) error
- func (s *PostStore) DeleteRevision(ctx context.Context, postID, revisionID uuid.UUID) error
- func (s *PostStore) List(ctx context.Context, f post.Filter) ([]post.Post, int, error)
- func (s *PostStore) PublishedBySlug(ctx context.Context, postType, slug string) (post.Post, error)
- func (s *PostStore) Restore(ctx context.Context, id uuid.UUID, updatedAt time.Time) (post.Post, error)
- func (s *PostStore) RevisionByID(ctx context.Context, postID, revisionID uuid.UUID) (post.Revision, error)
- func (s *PostStore) Revisions(ctx context.Context, postID uuid.UUID) ([]post.Revision, error)
- func (s *PostStore) SaveAutosave(ctx context.Context, autosave post.Revision) (post.Revision, error)
- func (s *PostStore) Trash(ctx context.Context, id uuid.UUID, updatedAt time.Time) (post.Post, error)
- func (s *PostStore) Update(ctx context.Context, p post.Post, expectedUpdatedAt time.Time, ...) (post.Post, error)
Constants ¶
This section is empty.
Variables ¶
var Migrations embed.FS
Migrations holds the core schema migration files applied by goose.
Functions ¶
Types ¶
type PostStore ¶
type PostStore struct {
// contains filtered or unexported fields
}
PostStore persists posts in the core schema.
func NewPostStore ¶
NewPostStore returns a PostStore backed by pool.
func (*PostStore) Autosave ¶
func (s *PostStore) Autosave(ctx context.Context, postID, authorID uuid.UUID) (post.Revision, error)
Autosave returns the author's autosave of the post, or post.ErrRevisionNotFound.
func (*PostStore) ByID ¶
ByID returns the post with the given id, or post.ErrNotFound.
func (*PostStore) Delete ¶
Delete removes the post, or reports post.ErrNotFound.
func (*PostStore) DeleteAutosave ¶
DeleteAutosave removes the author's autosave of the post.
func (*PostStore) DeleteRevision ¶
DeleteRevision removes the post's revision, or reports post.ErrRevisionNotFound.
func (*PostStore) List ¶
List returns the posts matching the filter without their content, and the total number matching it.
func (*PostStore) PublishedBySlug ¶
PublishedBySlug returns the published post of the given type and slug, or post.ErrNotFound.
func (*PostStore) Restore ¶
func (s *PostStore) Restore(ctx context.Context, id uuid.UUID, updatedAt time.Time) (post.Post, error)
Restore returns a trashed post to draft. It recovers the original slug, or leaves the trashed one in place when the original is taken.
func (*PostStore) RevisionByID ¶
func (s *PostStore) RevisionByID(ctx context.Context, postID, revisionID uuid.UUID) (post.Revision, error)
RevisionByID returns the post's revision, or post.ErrRevisionNotFound.
func (*PostStore) Revisions ¶
Revisions returns the post's revisions newest first, without their content.
func (*PostStore) SaveAutosave ¶
func (s *PostStore) SaveAutosave(ctx context.Context, autosave post.Revision) (post.Revision, error)
SaveAutosave stores the author's autosave of the post, replacing any earlier one.