Documentation ¶
Overview ¶
Package stores contains different store implementations using MongoDB as storage backend. If multiple storage backends are added, these files could be moved into appropriate packages (mongo, psql etc.) based on the backend they are using.
Index ¶
- type Posts
- func (posts *Posts) Delete(ctx context.Context, name string) (*domain.Post, error)
- func (posts *Posts) Exists(ctx context.Context, name string) bool
- func (posts *Posts) Get(ctx context.Context, name string) (*domain.Post, error)
- func (posts *Posts) Save(ctx context.Context, post domain.Post) (*domain.Post, error)
- type Users
- func (users *Users) Delete(ctx context.Context, name string) (*domain.User, error)
- func (users *Users) Exists(ctx context.Context, name string) bool
- func (users *Users) FindAll(ctx context.Context, tags []string, limit int) ([]domain.User, error)
- func (users *Users) FindByName(ctx context.Context, name string) (*domain.User, error)
- func (users *Users) Save(ctx context.Context, user domain.User) (*domain.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Posts ¶
type Posts struct {
// contains filtered or unexported fields
}
Posts manages persistence and retrieval of posts.
func NewPosts ¶
func NewPosts(db *mgo.Database) *Posts
NewPosts initializes the Posts store with given mongo db handle.
type Users ¶
type Users struct {
// contains filtered or unexported fields
}
Users implements UserStore interface.
func NewUsers ¶
func NewUsers(db *mgo.Database) *Users
NewUsers initializes a users store with the given db handle.
func (*Users) Exists ¶
Exists checks if the user identified by the given username already exists. Will return false in case of any error.
func (*Users) FindByName ¶
FindByName finds a user by name. If not found, returns ResourceNotFound error.