datagen

package
v0.0.0-...-96f1409 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KafkaTopic = "testtopic"

KafkaTopic sets the kafka topic

View Source
var RestProxyURL = "localhost:8082"

RestProxyURL sets the URL of the REST proxy

Functions

func ABA

func ABA() string

ABA returns a random 9 numeric digit string with about 27000 possible values.

func AreaCode

func AreaCode() int

AreaCode returns a area code

func City

func City() string

City returns a city

func CountryCode

func CountryCode() string

CountryCode returns a country code

func CountryCode3

func CountryCode3() string

CountryCode3 returns a country code

func CountryName

func CountryName() string

CountryName returns a country name

func CustomerID

func CustomerID() int

CustomerID returns a customer ID

func Db

func Db() string

Db returns a db

func Digits

func Digits() string

Digits returns from 1 to 5 digits as a string

func DigitsN

func DigitsN(n int) string

DigitsN returns n digits as a string

func DmaCode

func DmaCode() int

DmaCode returns a dma code

func HexColor

func HexColor() string

HexColor generates hex color name

func HexColorShort

func HexColorShort() string

HexColorShort generates short hex color name

func Latitude

func Latitude() float64

Latitude returns a latitude

func Longitude

func Longitude() float64

Longitude returns a longitude

func MetroCode

func MetroCode() int

MetroCode returns a metro code

func PostData

func PostData(restProxyURL string, kafkaTopic string) (response map[string]interface{}, err error)

PostData generates data and sends it to kafka's rest proxy

func PostalCode

func PostalCode() string

PostalCode returns a postal code

func Region

func Region() string

Region returns a region

func RegionName

func RegionName() string

RegionName returns a region name

func TimeZone

func TimeZone() string

TimeZone returns a time zone

func UserID

func UserID() int

UserID returns a user ID

Types

type GeoIP

type GeoIP struct {
	TimeZone     string  `json:"time_zone"`
	Longitude    float64 `json:"longitude"`
	Latitude     float64 `json:"latitude"`
	CountryName  string  `json:"country_name"`
	DmaCode      int     `json:"dma_code"`
	City         string  `json:"city"`
	Region       string  `json:"region"`
	MetroCode    int     `json:"metro_code"`
	PostalCode   string  `json:"postal_code"`
	AreaCode     int     `json:"area_code"`
	RegionName   string  `json:"region_name"`
	CountryCode3 string  `json:"country_code3"`
	CountryCode  string  `json:"country_code"`
}

GeoIP is a struct used in PostData

func (GeoIP) MarshalJSON

func (g GeoIP) MarshalJSON() ([]byte, error)

MarshalJSON returns a json Kafka can interpret

type Record

type Record struct {
	ABA        string `json:"aba"`
	Db         string `json:"db"`
	UserID     int    `json:"user_id"`
	CustomerID int    `json:"customer_id"`
	Timestamp  string `json:"timestamp"`
	GeoIP      GeoIP  `json:"geoip"`
}

Record is a struct used in PostData

func GenRecord

func GenRecord() *Record

GenRecord is utilized in PostData function to create a Record

type Value

type Value struct {
	Value map[string]interface{} `json:"value"`
}

Value is utilized in PostData function to create a Record

Jump to

Keyboard shortcuts

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