service

package
v0.0.0-...-08e0fe9 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultUserSettings = map[string]string{
	"theme":    "light",
	"language": "en",
}

Functions

func NewArticleService

func NewArticleService(repository *repotypes.Repository, fileService FileService) *articleService

func NewFileService

func NewFileService() *fileService

func NewMigrationService

func NewMigrationService(artService *articleService, userService *userService) *migrationService

func NewUserService

func NewUserService(repository *repotypes.Repository) *userService

Types

type ArticleService

type ArticleService interface {
	CreateNewArticle(string, string, []byte) (models.Article, error)
	DeleteArticle(fileName string) error
	UpdateArticle(fileName string) error
	//GetArticle(fileName string) (string, error)
	GetArticleInfo(fileName string) (models.Article, error)
	GetArticleBody(fileName string) ([]byte, error)
	GetArticlesList() ([]models.Article, error)
}

type FileService

type FileService interface {
	ReadFile(fileName string) ([]byte, error)
	CreateNewFile(path string, body []byte) error
	WriteFile(path string, body []byte) error
	CreateFolder(path string) error
	DeleteFile(path string) error
}

type MigrationService

type MigrationService interface {
	Migrate() error
}

type Service

type Service struct {
	FileService      FileService
	ArticleService   ArticleService
	MigrationService MigrationService
	UserService      UserService
	// contains filtered or unexported fields
}

func NewService

func NewService(repository *repotypes.Repository) *Service

type UserService

type UserService interface {
	CreateNewUser(string, string, string, string, bool) (models.User, error)
	GetUserById(string) (models.User, error)
	GetUserByName(string) (models.User, error)
	ChangeUserSettings(string, map[string]string) error
}

Jump to

Keyboard shortcuts

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