utils

package
v0.0.0-...-83c3a93 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCampaignType

func CheckCampaignType(campaign schema.Campaign, campaignType string) bool

CheckCampaignType matches campaign type

func CreateImpressionForPush

func CreateImpressionForPush(vwoInstance schema.VwoInstance, tagKey, tagValue, userID string) schema.Impression

CreateImpressionForPush creates the impression from the arguments passed to push

func CreateImpressionTrackingGoal

func CreateImpressionTrackingGoal(vwoInstance schema.VwoInstance, variationID int, userID, goalType string, campaignID, goalID int, revenueValue interface{}) schema.Impression

CreateImpressionTrackingGoal creates the impression from the arguments passed to track goal

func CreateImpressionTrackingUser

func CreateImpressionTrackingUser(vwoInstance schema.VwoInstance, campaignID int, variationID int, userID string) schema.Impression

CreateImpressionTrackingUser creates the impression from the arguments passed to track user

func GetCampaign

func GetCampaign(API string, settingsFile schema.SettingsFile, campaignKey string) (schema.Campaign, error)

GetCampaign function finds and returns campaign from given campaign_key.

func GetCampaignGoal

func GetCampaignGoal(API string, campaign schema.Campaign, goalIdentifier string) (schema.Goal, error)

GetCampaignGoal returns goal from given campaign and goal identifier.

func GetCampaignVariation

func GetCampaignVariation(API string, campaign schema.Campaign, variationName string) (schema.Variation, error)

GetCampaignVariation returns variation from given campaign and variationName.

func GetControlVariation

func GetControlVariation(campaign schema.Campaign) schema.Variation

GetControlVariation returns control variation from a given campaign

func GetKeyValue

func GetKeyValue(obj map[string]interface{}) (string, interface{})

GetKeyValue returns first key value pair of the given map

func GetRequest

func GetRequest(url string) (string, error)

GetRequest function to do a get call

func GetVariableForFeature

func GetVariableForFeature(variables []schema.Variable, variableKey string) schema.Variable

GetVariableForFeature gets the variable from the list of variables in the campaign that matches the variableKey

func GetVariableValueForVariation

func GetVariableValueForVariation(vwoInstance schema.VwoInstance, campaign schema.Campaign, variation schema.Variation, variableKey, userID string) schema.Variable

GetVariableValueForVariation gets the variable from the list of variables in the variation that matches the variableKey

func GetVariationAllocationRanges

func GetVariationAllocationRanges(vwoInstance schema.VwoInstance, variations []schema.Variation) []schema.Variation

GetVariationAllocationRanges returns list of variation with set allocation ranges.

func GetVariationBucketingRange

func GetVariationBucketingRange(weight float64) int

GetVariationBucketingRange returns the bucket size of variation.

func LogMessage

func LogMessage(logs interface{}, level, file, message string)

LogMessage function generates Log messages and logs them into the logger, logger can be defined by the user itself too

func ParseOptions

func ParseOptions(option interface{}) (options schema.Options)

ParseOptions - parses custom options

func ScaleVariations

func ScaleVariations(variations []schema.Variation) []schema.Variation

ScaleVariations function It extracts the weights from all the variations inside the campaign and scales them so that the total sum of eligible variations weights become 100%

func ValidateActivate

func ValidateActivate(campaignKey, userID string) bool

ValidateActivate - validates Activate API parameters

func ValidateGetFeatureVariableValue

func ValidateGetFeatureVariableValue(campaignKey, variableKey, userID string) bool

ValidateGetFeatureVariableValue - validates GetFeatureVariableValue API parameters

func ValidateGetVariationName

func ValidateGetVariationName(campaignKey, userID string) bool

ValidateGetVariationName - validates GetVariationName API parameters

func ValidateIsFeatureEnabled

func ValidateIsFeatureEnabled(campaignKey, userID string) bool

ValidateIsFeatureEnabled - validates IsFeatureEnabled API parameters

func ValidateLogger

func ValidateLogger(logs interface{}) bool

ValidateLogger - validates Custom logger

func ValidatePush

func ValidatePush(tagKey, tagValue, userID string) bool

ValidatePush - validates Push API parameters

func ValidateStorage

func ValidateStorage(storage interface{}) bool

ValidateStorage - validates Custom Storage

func ValidateTrack

func ValidateTrack(campaignKey, userID, goalIdentifier string) bool

ValidateTrack - validates Track API parameters

Types

This section is empty.

Jump to

Keyboard shortcuts

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