repository

package
v0.0.0-...-1e91f80 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 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 ArticleRepository

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

func NewArticleRepository

func NewArticleRepository(db *cache2go.CacheTable) *ArticleRepository

Creates a new article instance

func (*ArticleRepository) Delete

func (repo *ArticleRepository) Delete(id string) (bool, error)

Delete an article from database by its id. Returning false and error, when no object with the given was where found.

func (*ArticleRepository) GetAll

func (repo *ArticleRepository) GetAll() ([]*model.Article, error)

Fetches a list all Articles from the database.

func (*ArticleRepository) GetCreationStream

func (repo *ArticleRepository) GetCreationStream() chan *model.Article

Returns a channel receiving all Articles that will be created.

func (*ArticleRepository) GetSingle

func (repo *ArticleRepository) GetSingle(id string) (*model.Article, error)

Fetches a single Article by its id. Returning nil as Article when no Article with the given ID was found.

func (*ArticleRepository) Save

func (repo *ArticleRepository) Save(article *model.Article) (*model.Article, error)

Saves an article to the database. When the passed article object does not have the id-attribute set, a new id will be generated and assigned to the object. Timestamps are set automatically.

type IArticleRepository

type IArticleRepository interface {
	Save(article *model.Article) (*model.Article, error)
	GetAll() ([]*model.Article, error)
	GetSingle(string) (*model.Article, error)
	Delete(string) (bool, error)
	GetCreationStream() chan *model.Article
}

Jump to

Keyboard shortcuts

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