store

package
v0.0.0-...-8e0b2b1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListPostsOrderBy

type ListPostsOrderBy string
const (
	ListPostsOrderByCreatedAtDesc ListPostsOrderBy = ""
	ListPostsOrderByCreatedAtAsc  ListPostsOrderBy = "created_at_asc"
)

type ListPostsQuery

type ListPostsQuery struct {
	AuthorID       string
	TagID          string
	Title          string
	Query          string
	Visibility     entity.Visibility
	HasPassword    *bool
	HasPublished   *bool
	PublishedYear  string
	PublishedMonth string
	PublishedDay   string
	PublishedDate  string
	OrderBy        ListPostsOrderBy
	Offset         int
	Limit          int
}

func (*ListPostsQuery) Build

func (q *ListPostsQuery) Build() (query string, args []any)
type Navigation struct {
	ID       string
	URL      string
	Name     string
	Sequence int
}

type Post

type Post struct {
	ID          string
	Title       string
	Slug        string
	Excerpt     string
	CoverPath   string
	AuthorID    string
	Password    string
	Visibility  entity.Visibility
	Content     string
	PinnedAt    int64
	PublishedAt int64
	CreatedAt   int64
	UpdatedAt   int64
	IsDraft     bool
	IsHidden    bool
}

type Store

type Store struct {
	// contains filtered or unexported fields
}
var Instance *Store

func (*Store) ClearNavigations

func (s *Store) ClearNavigations(c context.Context) error

ClearNavigations

func (*Store) CountPosts

func (s *Store) CountPosts(c context.Context, q *ListPostsQuery) (int, error)

func (*Store) CountPostsByUser

func (s *Store) CountPostsByUser(c context.Context, uid string) (int, error)

func (*Store) CountTags

func (s *Store) CountTags(c context.Context, keyword string) (int, error)

CountTags

func (*Store) CountUsers

func (s *Store) CountUsers(c context.Context) (int, error)

func (*Store) CreateNavigation

func (s *Store) CreateNavigation(c context.Context, n *entity.NavigationW) error

CreateNavigation

func (*Store) CreatePost

func (s *Store) CreatePost(c context.Context, p *entity.PostW) error

CreatePost

func (*Store) CreateTag

func (s *Store) CreateTag(c context.Context, t *entity.TagW) error

CreateTag

func (*Store) CreateUser

func (s *Store) CreateUser(c context.Context, u *entity.UserW) error

CreateUser

func (*Store) DeletePost

func (s *Store) DeletePost(c context.Context, id string) error

DeletePost

func (*Store) DeletePostsByUser

func (s *Store) DeletePostsByUser(c context.Context, id string) error

DeletePostsByUser

func (*Store) DeleteTag

func (s *Store) DeleteTag(id string) error

DeleteTag

func (*Store) DeleteUser

func (s *Store) DeleteUser(c context.Context, id string) error

DeleteUser

func (*Store) GetPost

func (s *Store) GetPost(c context.Context, id string) (*entity.PostR, error)

GetPost

func (*Store) GetPostBySlug

func (s *Store) GetPostBySlug(c context.Context, slug string) (*entity.PostR, error)

GetPostBySlug

func (*Store) GetTag

func (s *Store) GetTag(c context.Context, id string) (*entity.TagR, error)

GetTag

func (*Store) GetTagsByName

func (s *Store) GetTagsByName(names []string) ([]*entity.TagR, error)

GetTagsByName

func (*Store) GetUser

func (s *Store) GetUser(c context.Context, id string) (*entity.UserR, error)

GetUser

func (*Store) ListNavigations

func (s *Store) ListNavigations(c context.Context) ([]*entity.NavigationR, error)

ListNavigations

func (*Store) ListPostDates

func (s *Store) ListPostDates(c context.Context) (data []string, err error)

func (*Store) ListPosts

func (s *Store) ListPosts(c context.Context, q *ListPostsQuery) ([]*entity.PostR, error)

func (*Store) ListTags

func (s *Store) ListTags(c context.Context, offset, limit int, keyword string) ([]*entity.TagR, error)

ListTags

func (*Store) ListTagsByPost

func (s *Store) ListTagsByPost(c context.Context, id string) ([]*entity.TagR, error)

ListTagsByPost

func (*Store) ListUsers

func (s *Store) ListUsers(c context.Context) ([]*entity.UserR, error)

ListUsers

func (*Store) SuspendUser

func (s *Store) SuspendUser(c context.Context, uid string) error

SuspendUser

func (*Store) TransferPosts

func (s *Store) TransferPosts(c context.Context, fromUserID, toUserID string) error

TransferPosts

func (*Store) UnsuspendUser

func (s *Store) UnsuspendUser(c context.Context, uid string) error

SuspendUser

func (*Store) UpdatePost

func (s *Store) UpdatePost(c context.Context, p *entity.PostW) error

UpdatePost

func (*Store) UpdateTag

func (s *Store) UpdateTag(c context.Context, t *entity.TagW) error

UpdateTag

func (*Store) UpdateUser

func (s *Store) UpdateUser(c context.Context, u *entity.UserW) error

UpdateUser

type Tag

type Tag struct {
	ID          string
	Slug        string
	Name        string
	Description string
	CreatedAt   int64
}

type User

type User struct {
	ID          string
	Username    string
	Password    string
	Nickname    string
	Bio         string
	AvatarPath  string
	CreatedAt   int64
	SuspendedAt int64
}

Jump to

Keyboard shortcuts

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