ab

package module
v0.0.0-...-8bd6830 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2022 License: MIT Imports: 17 Imported by: 0

README

ab-go

ab sdk for go, split with github.com/spaolacci/murmur3

Usage

import by go get -u github.com/imb2022/ab-go

  • run func Run(cfg Config)
  • split func Split(layerFlag, requestId string) (bucketNo int, experiment scheme.Experiment, err error)
  • close func Close() error

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close() error

func Run

func Run(cfg Config)

func Split

func Split(layerFlag, requestId string) (bucketNo int, experiment scheme.Experiment, err error)

Types

type Config

type Config struct {
	App   string        `json:"app" mapstructure:"app"`
	Kafka KafkaConsumer `json:"kafka" mapstructure:"kafka"`
	MySql MySql         `json:"mysql" mapstructure:"mysql"`
}

type KafkaConsumer

type KafkaConsumer struct {
	Enable  bool     `json:"enable" mapstructure:"enable"`
	Debug   bool     `json:"debug" mapstructure:"debug"`
	Errors  bool     `json:"errors" mapstructure:"errors"`
	Version string   `json:"version" mapstructure:"version"`
	Brokers []string `json:"brokers" mapstructure:"brokers"`
	// sarama.BalanceStrategyRange, sarama.BalanceStrategyRoundRobin, sarama.BalanceStrategySticky
	// range, roundrobin, sticky
	Topic string `json:"topic" mapstructure:"topic"`
	// Initial Should be OffsetNewest -1 or OffsetOldest -2. Defaults to OffsetNewest.
	Initial int64 `json:"initial" mapstructure:"initial"`
	// ReadUncommitted=0, ReadCommitted=1
	IsolationLevel    int           `json:"isolation_level" mapstructure:"isolation_level"`
	HeartbeatInterval time.Duration `json:"heartbeat_interval" mapstructure:"heartbeat_interval"`
	MaxProcessingTime time.Duration `json:"max_processing_time" mapstructure:"max_processing_time"`
	MaxWaitTime       time.Duration `json:"max_wait_time" mapstructure:"max_wait_time"`
	SessionTimout     time.Duration `json:"session_timeout" mapstructure:"session_timeout"`
}

KafkaConsumer kafka consumer

type MySql

type MySql struct {
	Enable             bool          `json:"enable" mapstructure:"enable"`
	Addr               string        `json:"addr" mapstructure:"addr"`
	User               string        `json:"user" mapstructure:"user"`
	Password           string        `json:"password" mapstructure:"password"`
	DBName             string        `json:"db_name" mapstructure:"db_name"`
	Charset            string        `json:"charset" mapstructure:"charset"`
	Collation          string        `json:"collation" mapstructure:"collation"`
	MaxOpenConnections int           `json:"max_open_connections" mapstructure:"max_open_connections"`
	MaxIdleConnections int           `json:"max_idle_connections" mapstructure:"max_idle_connections"`
	Debug              bool          `json:"debug" mapstructure:"debug"`
	TLS                bool          `json:"tls" mapstructure:"tls"`
	ParseTime          bool          `json:"parse_time" mapstructure:"parse_time"`
	ConnMaxLifetime    time.Duration `json:"conn_max_lifetime" mapstructure:"conn_max_lifetime"`
	Timeout            time.Duration `json:"timeout" mapstructure:"timeout"`
	ReadTimeout        time.Duration `json:"read_timeout" mapstructure:"read_timeout"`
	WriteTimeout       time.Duration `json:"write_timeout" mapstructure:"write_timeout"`
	LOC                string        `json:"loc" mapstructure:"loc"`
}

MySql mysql config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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