Documentation ¶
Index ¶
- type ArticleStorer
- type MongoArticleStore
- func (s *MongoArticleStore) GetArticleByID(ctx context.Context, id string) (*types.Article, error)
- func (s *MongoArticleStore) GetArticleByNewsArticleID(ctx context.Context, id int) (*types.Article, error)
- func (s *MongoArticleStore) GetArticles(ctx context.Context, opts *options.FindOptions) ([]*types.Article, error)
- func (s *MongoArticleStore) InsertArticle(ctx context.Context, article *types.Article) (*types.Article, error)
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 (*MongoArticleStore) GetArticleByNewsArticleID ¶
func (*MongoArticleStore) GetArticles ¶
func (s *MongoArticleStore) GetArticles(ctx context.Context, opts *options.FindOptions) ([]*types.Article, error)
func (*MongoArticleStore) InsertArticle ¶
Click to show internal directories.
Click to hide internal directories.