helpers

package
v0.0.0-...-8341997 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Content

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

Content is the helper for content entries

func NewContent

func NewContent(sql gateways.SQL) *Content

NewContent returns a new Content helper

func (*Content) Get

func (c *Content) Get(id string) (*models.Content, error)

Get returns the content referenced by the provided id, otherwise nil

func (*Content) GetAll

func (c *Content) GetAll(offset int, limit int) ([]*models.Content, error)

GetAll returns <limit> content entries from <offset> number

func (*Content) Insert

func (c *Content) Insert(content *models.Content) error

Insert adds the given content entry

func (*Content) SetStatus

func (c *Content) SetStatus(id string, status models.ContentStatus) error

SetStatus updates the status of the content with the given id

func (*Content) Update

func (c *Content) Update(content *models.Content) error

Update upserts the content with the given id

type ContentI

type ContentI interface {
	Get(string) (*models.Content, error)
	GetAll(int, int) ([]*models.Content, error)
	Insert(*models.Content) error
	Update(*models.Content) error
	SetStatus(string, models.ContentStatus) error
}

ContentI describes the functions for manipulating content models

type Job

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

Job Helper has helper methods for job entities and the database

func (*Job) GetAll

func (j *Job) GetAll(offset int, limit int) ([]*models.Job, error)

GetAll returns <limit> job entities starting at <offset>

func (*Job) GetByID

func (j *Job) GetByID(id string) (*models.Job, error)

GetByID returns one job with the give id, nil otherwise

func (*Job) Insert

func (j *Job) Insert(job *models.Job) error

Insert creates a new job from the arguments and errors if failure

func (*Job) SendJob

func (j *Job) SendJob() error

SendJob should queue messages based on a job, not sure whether to

do this by jobID or receipt yet

func (*Job) SetStatus

func (j *Job) SetStatus(id uuid.UUID, state models.Status) error

SetStatus updates the status of the job with the provided id

type JobI

type JobI interface {
	GetAll(int, int) ([]*models.Job, error)
	GetByID(string) (*models.Job, error)
	SetStatus(uuid.UUID, models.Status) error
	Insert(*models.Job) error
}

JobI describes the methods of job helpers

func NewJob

func NewJob(sql gateways.SQL) JobI

NewJob reutrns a constructed job helper

type Preference

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

Preference is the helper for preference entities

func (*Preference) GetAll

func (p *Preference) GetAll(offset int, limit int) ([]*models.Preference, error)

GetAll returns a list of <limit> preferences starting from <offset>

func (*Preference) GetByUserID

func (p *Preference) GetByUserID(id string) (*models.Preference, error)

GetByUserID returns a preference associated with the given user id

func (*Preference) Insert

func (p *Preference) Insert(preference *models.Preference) error

Insert adds a pereference entity to the database

func (*Preference) Update

func (p *Preference) Update(preference *models.Preference) error

Update sets the preference entry to the given values

type PreferenceI

type PreferenceI interface {
	Insert(*models.Preference) error
	GetAll(int, int) ([]*models.Preference, error)
	GetByUserID(string) (*models.Preference, error)
	Update(*models.Preference) error
}

PreferenceI describes the functions of preference helpers

func NewPreference

func NewPreference(sql gateways.SQL) PreferenceI

NewPreference constructs and returns a Preference helper

type Receipt

type Receipt struct {
	SG         gateways.SendgridI
	TC         tg.TownCenterI
	RB         gateways.RabbitI
	Preference PreferenceI
	// contains filtered or unexported fields
}

Receipt helps with managing receipt entities and fetching them

func (*Receipt) DeliverContent

func (r *Receipt) DeliverContent(receipt *models.Receipt, content *models.Content) error

DeliverContent combines receipt and content to send a message to the given ContentType

func (*Receipt) GetAll

func (r *Receipt) GetAll(offset int, limit int) ([]*models.Receipt, error)

GetAll returns a list of receipts of length <limit> starting at <offset>

func (*Receipt) GetByID

func (r *Receipt) GetByID(id string) (*models.Receipt, error)

GetByID returns the receipt entitiy with the given id

func (*Receipt) Insert

func (r *Receipt) Insert(receipt *models.Receipt) error

Insert takes a receipt model and appends it to the entity

func (*Receipt) Send

func (r *Receipt) Send(request *models.SendRequest) error

Send attempts to send the text to the recipient in the receipt receipt *models.Receipt, subject string, text string

func (*Receipt) SetStatus

func (r *Receipt) SetStatus(id uuid.UUID, state models.Status) error

SetStatus updates the status of the receipt with the given id

type ReceiptI

type ReceiptI interface {
	GetAll(int, int) ([]*models.Receipt, error)
	GetByID(string) (*models.Receipt, error)
	Insert(*models.Receipt) error
	SetStatus(uuid.UUID, models.Status) error
	Send(*models.SendRequest) error
	//Consume() error
	DeliverContent(*models.Receipt, *models.Content) error
}

ReceiptI describes methods for the Receipt Helper

func NewReceipt

func NewReceipt(sql gateways.SQL, sendgrid gateways.SendgridI, townCenter tg.TownCenterI, rabbit gateways.RabbitI) ReceiptI

NewReceipt constructs and returns a receipt helper

type Trigger

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

Trigger is the helper for trigger entites

func (*Trigger) Delete

func (t *Trigger) Delete(key string) error

Delete removes the trigger entry from the database

func (*Trigger) Get

func (t *Trigger) Get(key string) (*models.Trigger, error)

Get given a string key, returns the trigger associated with it

func (*Trigger) GetAll

func (t *Trigger) GetAll(offset int, limit int) ([]*models.Trigger, error)

GetAll returns <limit> trigger entities starting at <offset>

func (*Trigger) Insert

func (t *Trigger) Insert(trigger *models.Trigger) error

Insert creates a new trigger from the model and inserts it into the database

func (*Trigger) Update

func (t *Trigger) Update(key string, contentID uuid.UUID, values map[string]string) error

Update overwrites a trigger's entry with the given data

type TriggerI

type TriggerI interface {
	GetAll(int, int) ([]*models.Trigger, error)
	Get(string) (*models.Trigger, error)
	Update(string, uuid.UUID, map[string]string) error
	Insert(*models.Trigger) error
	Delete(string) error
}

TriggerI describes methods of the Trigger Helper

func NewTrigger

func NewTrigger(sql gateways.SQL) TriggerI

NewTrigger constructs and returns a new Trigger helper

Jump to

Keyboard shortcuts

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