Documentation ¶
Overview ¶
Package mongostore provides the mongodb store implementation.
Index ¶
- Variables
- type Config
- type Option
- type Store
- func (s *Store) Config() Config
- func (s *Store) Get(ctx context.Context, id uuid.UUID) (store.Letter, error)
- func (s *Store) Insert(ctx context.Context, let store.Letter) error
- func (s *Store) Query(ctx context.Context, q query.Query) (query.Cursor, error)
- func (s *Store) SetProjection(proj interface{})
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// Provider is the store provider name.
Provider = "mongo"
)
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { DatabaseName string CollectionName string CreateIndexes bool Projection interface{} // Custom mongodb *mongo.Collection.Find() projection }
Config is the store configuration.
type Option ¶
type Option func(*Config)
Option is a store option.
func Collection ¶
Collection configures the used collection. Defaults to "letters".
func CreateIndexes ¶
CreateIndexes configures the store to create the indexes for the fields of the letters. By default, this option is set to true.
func Projection ¶ added in v0.6.5
func Projection(proj interface{}) Option
Projection configures proj to be the used as the projection in the queries.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the mongodb store.
func New ¶
New creates a mongodb store. By default, the store uses the "postdog" database and "letters" collection. You can configure the store with opts.
func (*Store) SetProjection ¶ added in v0.6.5
func (s *Store) SetProjection(proj interface{})
SetProjection sets proj to be used as the projection in the queries.
Click to show internal directories.
Click to hide internal directories.