Documentation ¶
Index ¶
- type ClientOption
- type Config
- type ExperimentClient
- func (e *ExperimentClient) CheckIfFlowCtrlPlanTargetIsEnabled(env string, targetId int, currentTimestamp int64) bool
- func (e *ExperimentClient) GetFlowCtrlPlanMetaList(env string, currentTimestamp int64) []model.FlowCtrlPlan
- func (e *ExperimentClient) GetFlowCtrlPlanTargetList(env, sceneName string, currentTimestamp int64) map[int]model.FlowCtrlPlanTargets
- func (e *ExperimentClient) GetFlowCtrlPlanTargetTraffic(env, sceneName string, idList ...string) []FlowCtrlPlanTargetTraffic
- func (e *ExperimentClient) GetSceneParams(sceneName string) model.SceneParams
- func (e *ExperimentClient) LoadExperimentData()
- func (e *ExperimentClient) LoadSceneFlowCtrlPlansData()
- func (e *ExperimentClient) LoadSceneParamsData()
- func (e *ExperimentClient) MatchExperiment(sceneName string, experimentContext *model.ExperimentContext) *model.ExperimentResult
- func (e *ExperimentClient) Validate() error
- type FlowCtrlPlanTargetTraffic
- type Logger
- type LoggerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientOption ¶
type ClientOption func(c *ExperimentClient)
func WithErrorLogger ¶
func WithErrorLogger(l Logger) ClientOption
func WithLogger ¶
func WithLogger(l Logger) ClientOption
func WithToken ¶
func WithToken(token string) ClientOption
type ExperimentClient ¶
type ExperimentClient struct { // Host A/B Test server host Host string // Token the request header Authorization Token string // Environment control the sdk shoud get which environment data . // Valid value is daily, prepub,product Environment string // APIClient invoke api to connect to the A/B Test Server APIClient *api.APIClient // Logger specifies a logger used to report internal changes within the writer Logger Logger // ErrorLogger is the logger to report errors ErrorLogger Logger // contains filtered or unexported fields }
func NewExperimentClient ¶
func NewExperimentClient(host, environment string, opts ...ClientOption) (*ExperimentClient, error)
func (*ExperimentClient) CheckIfFlowCtrlPlanTargetIsEnabled ¶
func (e *ExperimentClient) CheckIfFlowCtrlPlanTargetIsEnabled(env string, targetId int, currentTimestamp int64) bool
func (*ExperimentClient) GetFlowCtrlPlanMetaList ¶
func (e *ExperimentClient) GetFlowCtrlPlanMetaList(env string, currentTimestamp int64) []model.FlowCtrlPlan
func (*ExperimentClient) GetFlowCtrlPlanTargetList ¶
func (e *ExperimentClient) GetFlowCtrlPlanTargetList(env, sceneName string, currentTimestamp int64) map[int]model.FlowCtrlPlanTargets
func (*ExperimentClient) GetFlowCtrlPlanTargetTraffic ¶
func (e *ExperimentClient) GetFlowCtrlPlanTargetTraffic(env, sceneName string, idList ...string) []FlowCtrlPlanTargetTraffic
func (*ExperimentClient) GetSceneParams ¶
func (e *ExperimentClient) GetSceneParams(sceneName string) model.SceneParams
func (*ExperimentClient) LoadExperimentData ¶
func (e *ExperimentClient) LoadExperimentData()
LoadExperimentData specifies a function to load data from A/B Test Server
func (*ExperimentClient) LoadSceneFlowCtrlPlansData ¶
func (e *ExperimentClient) LoadSceneFlowCtrlPlansData()
LoadSceneFlowCtrlPlansData specifies a function to load flow ctrl plan data from A/B Test Server
func (*ExperimentClient) LoadSceneParamsData ¶
func (e *ExperimentClient) LoadSceneParamsData()
LoadSceneParamsData specifies a function to load param data from A/B Test Server
func (*ExperimentClient) MatchExperiment ¶
func (e *ExperimentClient) MatchExperiment(sceneName string, experimentContext *model.ExperimentContext) *model.ExperimentResult
MatchExperiment specifies to find match experiment by the ExperimentContext If not find the scene return error or return ExperimentResult
func (*ExperimentClient) Validate ¶
func (e *ExperimentClient) Validate() error
Validate check the ExperimentClient value
type Logger ¶
type Logger interface {
Printf(string, ...interface{})
}
Logger interface API for log.Logger
type LoggerFunc ¶
type LoggerFunc func(string, ...interface{})
func (LoggerFunc) Printf ¶
func (f LoggerFunc) Printf(msg string, args ...interface{})
Click to show internal directories.
Click to hide internal directories.