Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCollection ¶
func NewCollection(pr *SessionProvider, tName string) (*mongo.Collection, context.Context, func(), error)
NewCollection initiates new collection for mongo
func SkipNoDocErr ¶
SkipNoDocErr checks error and skips if error is mongo.ErrNoDocuments
Types ¶
type CleanIDsProvider ¶
type CleanIDsProvider struct {
// contains filtered or unexported fields
}
CleanIDsProvider returns old IDs to remove from system
func NewCleanIDsProvider ¶
func NewCleanIDsProvider(sessionProvider *SessionProvider, expireDuration time.Duration, table string) (*CleanIDsProvider, error)
NewCleanIDsProvider creates CleanIDsProvider instances
func (*CleanIDsProvider) GetExpired ¶
func (p *CleanIDsProvider) GetExpired() ([]string, error)
GetExpired return expired IDs
type CleanRecord ¶
type CleanRecord struct {
// contains filtered or unexported fields
}
CleanRecord deletes mongo table record
func NewCleanRecord ¶
func NewCleanRecord(sessionProvider *SessionProvider, table string) (*CleanRecord, error)
NewCleanRecord initiates object
func (*CleanRecord) Clean ¶
func (fs *CleanRecord) Clean(ID string) error
Clean deletes record from table by ID
type Locker ¶
type Locker struct { SessionProvider *SessionProvider // contains filtered or unexported fields }
Locker acquires lock in db
func NewLocker ¶
func NewLocker(sessionProvider *SessionProvider, table string) (*Locker, error)
NewLocker creates Locker instance
type SessionProvider ¶
type SessionProvider struct { URL string // contains filtered or unexported fields }
SessionProvider connects and provides session for mongo DB
func NewSessionProvider ¶
func NewSessionProvider(url string, indexes []IndexData, store string) (*SessionProvider, error)
NewSessionProvider creates Mongo session provider
func (*SessionProvider) Healthy ¶
func (sp *SessionProvider) Healthy() error
Healthy checks if mongo DB is up
func (*SessionProvider) NewSession ¶
func (sp *SessionProvider) NewSession() (mongo.Session, error)
NewSession creates mongo session
Click to show internal directories.
Click to hide internal directories.