Documentation ¶
Index ¶
- Constants
- func MapToBsonM(m interface{}) (bson.M, error)
- type ConnectionConfig
- type Sequence
- type SequenceProvider
- func (msp *SequenceProvider) ListSequences(ctx context.Context, mask string) (map[string]int, error)
- func (msp *SequenceProvider) Prepare(eng *vivard.Engine, prov dep.Provider) (err error)
- func (msp *SequenceProvider) Provide() interface{}
- func (msp *SequenceProvider) Sequence(ctx context.Context, name string) (vivard.Sequence, error)
- func (msp *SequenceProvider) Start(eng *vivard.Engine, prov dep.Provider) error
- type Service
- func (ms *Service) DB() *mongo.Database
- func (ms *Service) GetDefaultMongo(ctx context.Context) (*mongo.Database, error)
- func (ms *Service) GetMongo(ctx context.Context, alias string) (*mongo.Database, error)
- func (ms *Service) Prepare(eng *vivard.Engine, prov dep.Provider) (err error)
- func (ms *Service) Provide() interface{}
- func (ms *Service) Start(eng *vivard.Engine, prov dep.Provider) error
- func (ms *Service) With(db *mongo.Database) *Service
Constants ¶
View Source
const (
ServiceMongo = "mongo"
)
Variables ¶
This section is empty.
Functions ¶
func MapToBsonM ¶
Types ¶
type ConnectionConfig ¶
type Sequence ¶
type Sequence struct {
// contains filtered or unexported fields
}
Sequence allows to create sequential numbers
current value is cached!
type SequenceProvider ¶
type SequenceProvider struct {
// contains filtered or unexported fields
}
func MongoSequenceForDB ¶
func MongoSequenceForDB(db *mongo.Database) *SequenceProvider
func MongoSequenceForService ¶
func MongoSequenceForService(ms *Service) *SequenceProvider
func (*SequenceProvider) ListSequences ¶
func (msp *SequenceProvider) ListSequences(ctx context.Context, mask string) (map[string]int, error)
ListSequences returns sequences with names containing mask (case-insensitive)
func (*SequenceProvider) Provide ¶
func (msp *SequenceProvider) Provide() interface{}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
New creates new mongo service params may be:
*mongo.Database (should be first) db-name (connect string will be build for the local host) pair connect string - db-name ConnectionConfig object
func (*Service) GetDefaultMongo ¶
GetDefaultMongo returns default database
Click to show internal directories.
Click to hide internal directories.