Documentation
¶
Overview ¶
Package postgres provides the PostgreSQL data layer for the CMS core.
Index ¶
- Variables
- func Migrate(ctx context.Context, databaseURL string) error
- type MediaStore
- func (s *MediaStore) ByID(ctx context.Context, id int64) (media.Media, error)
- func (s *MediaStore) Create(ctx context.Context, m media.Media) (media.Media, error)
- func (s *MediaStore) Delete(ctx context.Context, id int64) (media.Media, error)
- func (s *MediaStore) List(ctx context.Context, f media.Filter) ([]media.Media, int, error)
- func (s *MediaStore) Update(ctx context.Context, m media.Media, expectedUpdatedAt time.Time) (media.Media, 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)
- type SettingStore
Constants ¶
This section is empty.
Variables ¶
var Migrations embed.FS
Migrations holds the core schema migration files applied by goose.
Functions ¶
Types ¶
type MediaStore ¶ added in v0.3.0
type MediaStore struct {
// contains filtered or unexported fields
}
MediaStore persists the media library in the core schema.
func NewMediaStore ¶ added in v0.3.0
func NewMediaStore(pool *pgxpool.Pool) *MediaStore
NewMediaStore returns a MediaStore backed by pool.
func (*MediaStore) ByID ¶ added in v0.3.0
ByID returns the media item with the given id, or media.ErrNotFound.
func (*MediaStore) Create ¶ added in v0.3.0
Create stores a new media item and returns it with its assigned identifier.
func (*MediaStore) Delete ¶ added in v0.3.0
Delete removes the media item and returns it, or reports media.ErrNotFound.
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.
type SettingStore ¶ added in v0.2.0
type SettingStore struct {
// contains filtered or unexported fields
}
SettingStore persists named values in the core schema.
func NewSettingStore ¶ added in v0.2.0
func NewSettingStore(pool *pgxpool.Pool) *SettingStore
NewSettingStore returns a SettingStore backed by pool.