Documentation
¶
Index ¶
Constants ¶
const ( LocalExperimentFeatureName = "checkout" LocalExperimentID = 42 LocalExperimentName = "Checkout experiment" LocalExperimentVariant = "treatment" LocalExperimentVariantValue = "new checkout" LocalExperimentControlValue = "control" LocalExperimentOverriddenUser = "user_overridden" LocalExperimentOverrideValue = "overridden checkout" LocalNoExperimentFeatureName = "plain" LocalNoExperimentFeatureValue = "hello" )
Features in EnvironmentJsonWithExperiment.
const ( ExperimentFeatureName = "checkout_cta" ExperimentFeatureID = 10 ExperimentID = 42 ExperimentName = "checkout_exp" ExperimentVariant = "treatment" ExperimentReason = "SPLIT; weight=70.0" NotEnrolledFeatureName = "not_enrolled" NotEnrolledVariant = "control" NoMetadataFeatureName = "no_metadata" DisabledExperimentFeatureName = "disabled_experiment" NoVariantFeatureName = "no_variant" )
Features in IdentityResponseJsonWithExperiment.
const BaseURL = "http://localhost:8000/api/v1/"
const ClientAPIKey = "B62qaMZNwfiqT76p38ggrQ"
const EnvironmentAPIKey = "ser.test_key"
const EnvironmentJson = `` /* 1948-byte string literal not displayed */
const EnvironmentJsonPage2 = `` /* 1000-byte string literal not displayed */
EnvironmentJsonPage2 contains only identity_overrides — the base environment fields are irrelevant for subsequent pages since only IdentityOverrides are merged.
const EnvironmentJsonWithExperiment = `` /* 2294-byte string literal not displayed */
EnvironmentJsonWithExperiment runs an experiment on "checkout", whose rollout segment is identities on the premium plan, serving them the "treatment" variant. "user_overridden" has an identity override for "checkout", and "plain" has no experiment.
const EnvironmentJsonWithFlagDependency = `` /* 1549-byte string literal not displayed */
EnvironmentJsonWithFlagDependency contains a feature overridden by a segment that matches when another feature, the prerequisite, is enabled.
const EnvironmentJsonWithMultivariateFeature = `` /* 966-byte string literal not displayed */
EnvironmentJsonWithMultivariateFeature contains a single multivariate feature whose only variant is keyed and allocated 100%, so every identity is bucketed into it.
const EnvironmentJsonWithSegmentOverride = `` /* 1478-byte string literal not displayed */
const EnvironmentJsonWithTraitSegmentOverride = `` /* 1260-byte string literal not displayed */
EnvironmentJsonWithTraitSegmentOverride contains a feature overridden by a segment that matches identities with the trait "plan" set to "premium".
const Feature1ID = 1
const Feature1IdentityReason = "SPLIT; weight=50.0"
const Feature1IdentityVariant = "treatment"
const Feature1Name = "feature_1"
const Feature1OverriddenValue = "some-overridden-value"
const Feature1Reason = "DEFAULT"
const Feature1Value = "some_value"
const FlagsJson = `` /* 372-byte string literal not displayed */
const IdentityResponseJson = `` /* 506-byte string literal not displayed */
const IdentityResponseJsonWithExperiment = `` /* 1467-byte string literal not displayed */
IdentityResponseJsonWithExperiment carries one enrolled flag, one flag whose identity is outside the rollout, one flag without metadata, one disabled flag that is enrolled and one enrolled flag without a variant.
const MVFeatureName = "mv_feature"
const MVFeatureVariantKey = "treatment"
const MVFeatureVariantValue = "variant_value"
const OverriddenIdentifier = "overridden-id"
const OverriddenIdentifierPage2 = "overridden-id-page2"
const PageID = "identity_override:1:00000000-0000-0000-0000-000000000001"
const PageIDEncoded = "identity_override%3A1%3A00000000-0000-0000-0000-000000000001"
Variables ¶
This section is empty.
Functions ¶
func EnvironmentDocumentHandler ¶
func EnvironmentDocumentHandler(rw http.ResponseWriter, req *http.Request)
func FlagsAPIHandlerWithInternalServerError ¶
func FlagsAPIHandlerWithInternalServerError(rw http.ResponseWriter, req *http.Request)
func PaginatedEnvironmentDocumentHandler ¶ added in v5.1.0
func PaginatedEnvironmentDocumentHandler(rw http.ResponseWriter, req *http.Request)
PaginatedEnvironmentDocumentHandler serves two pages of environment document. Page 1 includes a Link header pointing to page 2. Page 2 has no Link header.
Types ¶
type EventsAPIHandler ¶ added in v5.3.0
type EventsAPIHandler struct {
Statuses []int
// contains filtered or unexported fields
}
EventsAPIHandler is a fake events API. It records every request under a mutex and answers with the next status in Statuses, or 202 once they are used up.
func (*EventsAPIHandler) Events ¶ added in v5.3.0
func (h *EventsAPIHandler) Events() []map[string]interface{}
Events returns every event received so far, decoded, in arrival order.
func (*EventsAPIHandler) Requests ¶ added in v5.3.0
func (h *EventsAPIHandler) Requests() []EventsRequest
Requests returns a copy of the requests received so far.
func (*EventsAPIHandler) ServeHTTP ¶ added in v5.3.0
func (h *EventsAPIHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)