store

package
v0.0.0-...-6475e20 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 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 ArticleStorer

type ArticleStorer interface {
	GetArticleByID(context.Context, string) (*types.Article, error)
	GetArticleByNewsArticleID(context.Context, int) (*types.Article, error)
	GetArticles(context.Context, *options.FindOptions) ([]*types.Article, error)
	InsertArticle(context.Context, *types.Article) (*types.Article, error)
}

Ideally we could use more interface methods for CRUD operations but including only those required to complete the task.

func NewMongoArticleStore

func NewMongoArticleStore(client *mongo.Client, dbname string) ArticleStorer

type MongoArticleStore

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

func (*MongoArticleStore) GetArticleByID

func (s *MongoArticleStore) GetArticleByID(ctx context.Context, id string) (*types.Article, error)

func (*MongoArticleStore) GetArticleByNewsArticleID

func (s *MongoArticleStore) GetArticleByNewsArticleID(ctx context.Context, id int) (*types.Article, error)

func (*MongoArticleStore) GetArticles

func (s *MongoArticleStore) GetArticles(ctx context.Context, opts *options.FindOptions) ([]*types.Article, error)

func (*MongoArticleStore) InsertArticle

func (s *MongoArticleStore) InsertArticle(ctx context.Context, article *types.Article) (*types.Article, error)

Jump to

Keyboard shortcuts

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