bx24sync

package module
v0.0.0-...-b08d2d7 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 13 Imported by: 0

README

bx24-service

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultCheckInput

func DefaultCheckInput(reader io.Reader) (bool, error)

body would be like {"#",8f8a65b4-94c4-4794-b3e2-800d18d503ca,151:80d60cc47a5468a511e5f0049748a86c}

func DefaultHandler

func DefaultHandler(writer *KafkaWriter, key string) func(http.ResponseWriter, *http.Request) error

func GetEnvAsBool

func GetEnvAsBool(key string, defaultValue bool) bool

func GetEnvAsInt

func GetEnvAsInt(key string, defaultValue int) int

func GetEnvAsString

func GetEnvAsString(key string, defaultValue string) string

func GetEnvAsStringSlice

func GetEnvAsStringSlice(key string, sep string, defaultValue []string) []string

func LoadEnv

func LoadEnv(path string) (err error)

Types

type BasicAuth

type BasicAuth struct {
	User     string `json:"user"`
	Password string `json:"password"`
}

func (BasicAuth) GetPair

func (s BasicAuth) GetPair(sep string) string

type CheckInput

type CheckInput func(r io.Reader) (bool, error)

type ConsumerConfig

type ConsumerConfig struct {
	Brokers           []Socket `json:"brokers"`
	Topic             string   `json:"topic"`
	GroupId           string   `json:"groupId"`
	Partition         int      `json:"Partition"`
	GeneratorEndpoint Endpoint `json:"generatorEndpoint"`
	TargetEndpoint    Endpoint `json:"targetEndpoint"`
}

func NewConsumerConfigFromEnv

func NewConsumerConfigFromEnv() (ConsumerConfig, error)

type DataBaseConnection

type DataBaseConnection struct {
	Socket    `json:"socket"`
	BasicAuth `json:"auth"`
	Database  string `json:"database"`
}

func NewDataBaseConnectionFromEnv

func NewDataBaseConnectionFromEnv() DataBaseConnection

func (DataBaseConnection) MakeConnURL

func (c DataBaseConnection) MakeConnURL() *url.URL

type Endpoint

type Endpoint struct {
	Socket
	Method string
	SSL    bool
}

func (Endpoint) URL

func (e Endpoint) URL() string

type GeneratorConfig

type GeneratorConfig struct {
	DB              DataBaseConnection `json:"db"`
	Web             Socket             `json:"web"`
	StorageQueryTxt string             `json:"queryDir"`
	CheckInput      bool               `json:"checkInput"`
}

func NewGeneratorConfigFromEnv

func NewGeneratorConfigFromEnv() GeneratorConfig

type HandlerFunc

type HandlerFunc func(http.ResponseWriter, *http.Request) error

type HttpMethod

type HttpMethod struct {
	Path    string
	Handler HandlerFunc
	CheckInput
	AllowMethods []string
}

func NewHttpMethod

func NewHttpMethod(path string, handler HandlerFunc, checkInput CheckInput, allowsMethods []string) HttpMethod

type KafkaScanner

type KafkaScanner struct {
	// contains filtered or unexported fields
}

func NewKafkaScanner

func NewKafkaScanner(config ConsumerConfig) KafkaScanner

func (*KafkaScanner) Err

func (r *KafkaScanner) Err() error

func (*KafkaScanner) Message

func (r *KafkaScanner) Message() Message

func (*KafkaScanner) Scan

func (r *KafkaScanner) Scan() bool

type KafkaWriter

type KafkaWriter struct {
	// contains filtered or unexported fields
}

func NewKafkaWriter

func NewKafkaWriter(kafkaURL string, topic string) *KafkaWriter

func (*KafkaWriter) Close

func (w *KafkaWriter) Close() (err error)

func (*KafkaWriter) Write

func (w *KafkaWriter) Write(msg Message) (err error)

type Message

type Message struct {
	Topic     string
	Partition int
	Offset    int64
	Key       []byte
	Value     []byte
}

func (*Message) String

func (m *Message) String() string

type ProducerConfig

type ProducerConfig struct {
	Broker Socket `json:"broker"`
	Topic  string `json:"topic"`
}

type RegistrarConfig

type RegistrarConfig struct {
	Http Socket
	ProducerConfig
	CheckInput bool
}

func NewRegistrarConfigFromEnv

func NewRegistrarConfigFromEnv() RegistrarConfig

type ReponseLogger

type ReponseLogger struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func (*ReponseLogger) Status

func (l *ReponseLogger) Status() int

func (*ReponseLogger) WriteHeader

func (l *ReponseLogger) WriteHeader(code int)

type Router

type Router struct {
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(accessLog io.Writer, errorLog io.Writer, enableLoggingBody bool) (r Router)

func (*Router) AddMethod

func (r *Router) AddMethod(method HttpMethod)

func (Router) ServeHTTP

func (r Router) ServeHTTP(w http.ResponseWriter, req *http.Request)

type Socket

type Socket struct {
	Host string `json:"host"`
	Port int    `json:"port"`
}

func (Socket) String

func (s Socket) String() string

Directories

Path Synopsis
main
scheme
sql
sql

Jump to

Keyboard shortcuts

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