store

package
v0.0.0-...-f02d9f3 Latest Latest
Warning

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

Go to latest
Published: May 4, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const LabelsIndex = "labels"
View Source
const MailIndex = "mail"

Variables

This section is empty.

Functions

This section is empty.

Types

type Label

type Label struct {
	Id   string
	Name string
}

type LabelsDoc

type LabelsDoc struct {
	Id     string
	Labels []*Label
}

type Message

type Message struct {
	Id                  string
	Url                 string
	ThreadId            string
	LabelIds            []string
	Date                time.Time
	DownloadedStartedAt time.Time
	To                  string
	Cc                  string
	From                string
	Subject             string
	Snippet             string
	Body                string
	Source              gmail.Message
}

type MessageResponse

type MessageResponse struct {
	Message  Message
	Response *elastic.IndexResponse
}

type MessageSearch

type MessageSearch interface {
	QueryString() string
	Do() ([]*Message, error)
}

type RawMessageSearch

type RawMessageSearch struct {
	// contains filtered or unexported fields
}

func (RawMessageSearch) Do

func (r RawMessageSearch) Do() ([]*Message, error)

func (RawMessageSearch) QueryString

func (r RawMessageSearch) QueryString() string

type Service

type Service struct {
	Client      *elastic.Client
	Ctx         context.Context
	MailIndex   string
	LabelsIndex string
}

func New

func New(ctx context.Context) (*Service, error)

New returns Elastic initialized with elastic client

func (*Service) FindLabelId

func (s *Service) FindLabelId(labelName string) (string, error)

func (*Service) GetLabels

func (s *Service) GetLabels(userOnly bool) ([]*Label, error)

func (*Service) GetMessage

func (s *Service) GetMessage(id string) (Message, error)

func (*Service) GetMessages

func (s *Service) GetMessages(req *elastic.SearchService) ([]*Message, error)

func (*Service) GetStats

func (s *Service) GetStats() (Stats, error)

func (*Service) NewRawMessageSearch

func (s *Service) NewRawMessageSearch(q string) RawMessageSearch

func (*Service) NewStructuredMessageSearch

func (s *Service) NewStructuredMessageSearch() StructuredMessageSearch

func (*Service) SaveLabels

func (s *Service) SaveLabels(labels []*Label) error

func (*Service) SaveMessage

func (s *Service) SaveMessage(data Message, responses chan<- *MessageResponse) error

type Stats

type Stats struct {
	Earliest time.Time
	Latest   time.Time
	Total    int64
}

type StructuredMessageSearch

type StructuredMessageSearch struct {
	// contains filtered or unexported fields
}

func (StructuredMessageSearch) BodyOrSubject

func (StructuredMessageSearch) DateRange

func (s StructuredMessageSearch) DateRange(d1, d2, tz string) StructuredMessageSearch

func (StructuredMessageSearch) Do

func (s StructuredMessageSearch) Do() ([]*Message, error)

func (StructuredMessageSearch) Label

func (StructuredMessageSearch) Participants

func (s StructuredMessageSearch) Participants(participants string) StructuredMessageSearch

func (StructuredMessageSearch) QueryString

func (s StructuredMessageSearch) QueryString() string

func (StructuredMessageSearch) Size

func (StructuredMessageSearch) Sort

func (StructuredMessageSearch) Starred

Jump to

Keyboard shortcuts

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