campaigns

package
v0.0.0-...-92b9631 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TableName is the table used to store the data
	TableName = "trinacia"
)

Variables

View Source
var (
	// ErrorMissingUserID missing user id
	ErrorMissingUserID = errors.New("Missing User ID")
	// ErrorMissingPlatform missing platform
	ErrorMissingPlatform = errors.New("Missing Platform")
	// ErrorMissingAdAccount missing ad account
	ErrorMissingAdAccount = errors.New("Missing ad account")
	// ErrorMissingSegment missing segment
	ErrorMissingSegment = errors.New("Missing segment")
	// ErrorInvalidCampaign one or more fields is missing to create a campaign
	ErrorInvalidCampaign = errors.New("Missing some of the required campaign fields")
	// ErrorMissingCampaignID missing campaign id
	ErrorMissingCampaignID = errors.New("Missing campaign id")
	// ErrorUnableToFindCampaign get campaign found no result
	ErrorUnableToFindCampaign = errors.New("Unable to find the campaign")
)

Functions

This section is empty.

Types

type Storage

type Storage interface {
	// Campaign storage
	StoreCampaign(userID, platform, adAccount, segment string, c *entities.Campaign) error
	GetCampaign(campaignID string) (*entities.Campaign, error)
	GetUserCampaigns(userID string) (map[string][]string, error)
	// GetActiveCampaigns returns a maping from userID to active campaigns' ID
	GetActiveCampaigns(platform string) (map[string][]string, error)

	// Segment Storage
	// SetSegment initialices a segment to the provided initial targeting population
	SetSegment(userID, segment string, initialPopulation []*genetic.Chromosome) error
	// GetSegment returns initial targeting population of the segment
	GetSegment(userID, segment string) ([]*genetic.Chromosome, error)
	// GetSegments returns the names of user defined segments
	GetSegments(userID string) ([]string, error)
	// GetSegmentCampaigns returns all campaigns created by a
	// user initialized segment sorted in decesing order by end time
	GetSegmentCampaigns(userID, segment string) ([]string, error)
}

Storage interface to get campaign information from database

func New

func New(sess *session.Session) Storage

New isntanciates a session dynamo session to query information about users' campaigns

Jump to

Keyboard shortcuts

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