Documentation ¶
Index ¶
- type IndexData
- type SessionProvider
- type TextRecord
- type TextSaver
- func (ss *TextSaver) All() ([]*TextRecord, error)
- func (ss *TextSaver) Delete(ID string) (int, error)
- func (ss *TextSaver) GetCount(requestID string, reqType utils.RequestTypeEnum) (int64, error)
- func (ss *TextSaver) LoadText(requestID string, reqType utils.RequestTypeEnum) (string, error)
- func (ss *TextSaver) Save(req, text string, reqType utils.RequestTypeEnum, tags []string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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) (*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
type TextRecord ¶
type TextRecord struct { ID string `json:"id"` Type int `json:"type"` Text string `json:"text"` Created time.Time `json:"created,omitempty"` Tags []string `json:"tags,omitempty"` }
TextRecord data in mongo db
type TextSaver ¶
type TextSaver struct {
SessionProvider *SessionProvider
}
TextSaver saves text to mongo DB
func NewTextSaver ¶
func NewTextSaver(sessionProvider *SessionProvider) (*TextSaver, error)
NewTextSaver creates TextSaver instance
Click to show internal directories.
Click to hide internal directories.