storage

package
v0.0.0-...-1700b71 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSameCategory = errors.New("a category can not be assigned to itself")

Functions

This section is empty.

Types

type ArticleStore

type ArticleStore struct {
	// contains filtered or unexported fields
}

func (*ArticleStore) ConvertImagesToLocal

func (b *ArticleStore) ConvertImagesToLocal(art string) string

func (*ArticleStore) CreateArticle

func (b *ArticleStore) CreateArticle(art models.Article, author models.User) error

func (*ArticleStore) DeleteArticle

func (b *ArticleStore) DeleteArticle(art models.Article) error

func (*ArticleStore) GetArticle

func (b *ArticleStore) GetArticle(id string) (models.Article, error)

func (*ArticleStore) GetArticleHistory

func (b *ArticleStore) GetArticleHistory(artID string) ([]models.ArticleHistoryEntry, error)

func (*ArticleStore) ListArticles

func (b *ArticleStore) ListArticles(limit, offset int, sortBy string, reverse bool, public bool) ([]models.Article, int, error)

func (*ArticleStore) ListArticlesForCategory

func (b *ArticleStore) ListArticlesForCategory(catID string, public bool) ([]models.Article, error)

func (*ArticleStore) SearchArticles

func (b *ArticleStore) SearchArticles(q string, public bool) ([]models.Article, error)

func (*ArticleStore) UpdateArticle

func (b *ArticleStore) UpdateArticle(art models.Article, author models.User) error

type BoltHoldClient

type BoltHoldClient struct {
	ImageStore ImageStore
	*ArticleStore
	*CategoryStore
	*UserStore
	// contains filtered or unexported fields
}

func NewBoltHoldClient

func NewBoltHoldClient(path string) (*BoltHoldClient, error)

func (*BoltHoldClient) Backup

func (b *BoltHoldClient) Backup(w io.Writer) error

func (*BoltHoldClient) GetImage

func (b *BoltHoldClient) GetImage(hash string) []byte

func (*BoltHoldClient) UpdateUser

func (b *BoltHoldClient) UpdateUser(user models.User, password string) error

type CategoryStore

type CategoryStore struct {
	ImageStore ImageStore
	// contains filtered or unexported fields
}

func (*CategoryStore) CreateCategory

func (b *CategoryStore) CreateCategory(cat models.Category) error

func (*CategoryStore) DeleteCategory

func (b *CategoryStore) DeleteCategory(cat models.Category) error

func (*CategoryStore) GetCategory

func (b *CategoryStore) GetCategory(id string) (models.Category, error)

func (*CategoryStore) ListCategories

func (b *CategoryStore) ListCategories(public bool) ([]models.Category, error)

func (*CategoryStore) ListCategoriesForCategory

func (b *CategoryStore) ListCategoriesForCategory(catID string, public bool) ([]models.Category, error)

func (*CategoryStore) SearchCategories

func (b *CategoryStore) SearchCategories(q string, public bool) ([]models.Category, error)

func (*CategoryStore) UpdateCategory

func (b *CategoryStore) UpdateCategory(cat models.Category) error

type ImageStore

type ImageStore interface {
	Get(hash string) []byte
	Insert(uri string) (string, error)
}

type UserStore

type UserStore struct {
	ImageStore ImageStore
	// contains filtered or unexported fields
}

func (*UserStore) Authenticate

func (b *UserStore) Authenticate(username, password string) (*models.User, error)

func (*UserStore) CreateUser

func (b *UserStore) CreateUser(user models.User, password string) error

func (*UserStore) DeleteUser

func (b *UserStore) DeleteUser(user models.User) error

func (*UserStore) GetUser

func (b *UserStore) GetUser(name string) (models.User, error)

func (*UserStore) ListUsers

func (b *UserStore) ListUsers() ([]models.User, error)

func (*UserStore) UpdateUser

func (b *UserStore) UpdateUser(user models.User, password string) error

Jump to

Keyboard shortcuts

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