mongo

package
v0.0.0-...-4c7982d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2023 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CleanIDsProvider

type CleanIDsProvider struct {
	SessionProvider *SessionProvider
	// contains filtered or unexported fields
}

CleanIDsProvider returns old IDs to remove from system

func NewCleanIDsProvider

func NewCleanIDsProvider(sessionProvider *SessionProvider, expireDuration time.Duration) (*CleanIDsProvider, error)

NewCleanIDsProvider creates CleanIDsProvider instances

func (*CleanIDsProvider) Get

func (p *CleanIDsProvider) Get() ([]string, error)

Get return expired IDs

type CleanRecord

type CleanRecord struct {
	SessionProvider *SessionProvider
	Table           string
}

CleanRecord deletes mongo table record

func NewCleanRecords

func NewCleanRecords(sessionProvider *SessionProvider) ([]*CleanRecord, error)

NewCleanRecords creates CleanRecord instances

func (*CleanRecord) Clean

func (fs *CleanRecord) Clean(ID string) error

Clean deletes record from table by ID

type EmailRetriever

type EmailRetriever struct {
	SessionProvider *SessionProvider
}

EmailRetriever returns email by transcription ID

func NewEmailRetriever

func NewEmailRetriever(sessionProvider *SessionProvider) (*EmailRetriever, error)

NewEmailRetriever creates EmailRetriever instance

func (*EmailRetriever) Get

func (ss *EmailRetriever) Get(id string) (string, error)

Get returns email by ID

type FileNameProvider

type FileNameProvider struct {
	SessionProvider *SessionProvider
}

FileNameProvider returns file name by transcription ID

func NewFileNameProvider

func NewFileNameProvider(sessionProvider *SessionProvider) (*FileNameProvider, error)

NewFileNameProvider creates FileNameProvider instance

func (*FileNameProvider) Get

func (ss *FileNameProvider) Get(id string) (string, error)

Get returns filename by ID

type IndexData

type IndexData struct {
	Table  string
	Fields []string
	Unique bool
}

IndexData keeps index creation data

type Locker

type Locker struct {
	SessionProvider *SessionProvider
}

Locker acquires lock in db

func NewLocker

func NewLocker(sessionProvider *SessionProvider) (*Locker, error)

NewLocker creates Locker instance

func (*Locker) Lock

func (ss *Locker) Lock(id string, lockKey string) error

Lock locks record for sending email

func (*Locker) UnLock

func (ss *Locker) UnLock(id string, lockKey string, value *int) error

UnLock marks record with specific value

type RequestSaver

type RequestSaver struct {
	SessionProvider *SessionProvider
}

RequestSaver saves process request to mongo db

func NewRequestSaver

func NewRequestSaver(sessionProvider *SessionProvider) (*RequestSaver, error)

NewRequestSaver creates RequestSaver instance

func (*RequestSaver) Save

func (ss *RequestSaver) Save(data *persistence.Request) error

Save saves resquest to DB

type ResultSaver

type ResultSaver struct {
	SessionProvider *SessionProvider
}

ResultSaver saves process status to mongo db

func NewResultSaver

func NewResultSaver(sessionProvider *SessionProvider) (*ResultSaver, error)

NewResultSaver creates ResultSaver instance

func (*ResultSaver) Save

func (fs *ResultSaver) Save(ID string, result string) error

Save saves result to DB

type SessionProvider

type SessionProvider struct {
	URL string
	// contains filtered or unexported fields
}

SessionProvider connects and provides session for mongo DB

func NewSessionProvider

func NewSessionProvider() (*SessionProvider, error)

NewSessionProvider creates Mongo session provider

func (*SessionProvider) Close

func (sp *SessionProvider) Close()

Close closes mongo session

func (*SessionProvider) Healthy

func (sp *SessionProvider) Healthy() error

Healthy checks if mongo DB is up

func (*SessionProvider) NewSession

func (sp *SessionProvider) NewSession() (mgo.Session, error)

NewSession creates mongo session

type StatusProvider

type StatusProvider struct {
	SessionProvider *SessionProvider
}

StatusProvider provides transcription status from mongo db

func NewStatusProvider

func NewStatusProvider(sessionProvider *SessionProvider) (*StatusProvider, error)

NewStatusProvider creates StatusProvider instance

func (StatusProvider) Get

Get retrieves status from DB

type StatusSaver

type StatusSaver struct {
	SessionProvider *SessionProvider
	// contains filtered or unexported fields
}

StatusSaver saves process status to mongo db

func NewStatusSaver

func NewStatusSaver(sessionProvider *SessionProvider) (*StatusSaver, error)

NewStatusSaver creates StatusSaver instance

func (*StatusSaver) Save

func (ss *StatusSaver) Save(ID string, st status.Status) error

Save saves status to DB

func (*StatusSaver) SaveError

func (ss *StatusSaver) SaveError(ID string, errorStr string) error

SaveError saves error to DB

func (*StatusSaver) SaveF

func (ss *StatusSaver) SaveF(id string, set, unset map[string]interface{}) error

SaveF saves status to DB fields

type WorkSaver

type WorkSaver struct {
	SessionProvider *SessionProvider
}

WorkSaver saves process work data to mongo db

func NewWorkSaver

func NewWorkSaver(sessionProvider *SessionProvider) (*WorkSaver, error)

NewWorkSaver creates WorkSaver instance

func (*WorkSaver) Get

func (ws *WorkSaver) Get(id string) (*persistence.WorkData, error)

Get retrieves status from DB

func (*WorkSaver) Save

func (ws *WorkSaver) Save(data *persistence.WorkData) error

Save saves data to DB

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL