common

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 4 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateOption added in v1.1.2

func ValidateOption(option *GraphOption) error

Types

type CSVReader

type CSVReader struct {
	Path       string
	Delimiter  string
	WithHeader bool
	// contains filtered or unexported fields
}

func NewCsvReader

func NewCsvReader(path, delimiter string, withHeader bool, limit int) *CSVReader

func (*CSVReader) ReadForever

func (c *CSVReader) ReadForever(dataCh chan<- Data) error

ReadForever read the csv in slice first, and send to the data channel forever.

type CSVWriter

type CSVWriter struct {
	Path      string
	Header    []string
	Delimiter string
	DataCh    <-chan []string
}

func NewCsvWriter

func NewCsvWriter(path, delimiter string, header []string, dataCh <-chan []string) *CSVWriter

func (*CSVWriter) WriteForever

func (c *CSVWriter) WriteForever() error

type CsvOption added in v1.1.2

type CsvOption struct {
	CsvPath        string `json:"csv_path"`
	CsvDelimiter   string `json:"csv_delimiter"`
	CsvWithHeader  bool   `json:"csv_with_header"`
	CsvChannelSize int    `json:"csv_channel_size"`
	CsvDataLimit   int    `json:"csv_data_limit"`
}

type Data

type Data []string

Data data in csv file

type GraphOption added in v1.1.2

type GraphOption struct {
	PoolOption   `json:",inline"`
	OutputOption `json:",inline"`
	CsvOption    `json:",inline"`
	RetryOption  `json:",inline"`
	SSLOption    `json:",inline"`
}

func MakeDefaultOption added in v1.1.2

func MakeDefaultOption(opt *GraphOption) *GraphOption

type IClient

type IClient interface {
	Open() error
	Close() error
}

IClient common client

type IClientPool

type IClientPool interface {
	Close() error
}

IClientPool common client pool

type ICsvReader added in v1.1.0

type ICsvReader interface {
	ReadForever(dataCh chan<- Data) error
}

type IGraphClient

type IGraphClient interface {
	IClient
	GetData() (Data, error)
	Execute(stmt string) (IGraphResponse, error)
}

IGraphClient graph client

type IGraphClientPool

type IGraphClientPool interface {
	IClientPool
	GetSession() (IGraphClient, error)
	// Init initialize the poop with default channel bufferSize
	Init() (IGraphClientPool, error)
	SetOption(*GraphOption) error
}

IGraphClientPool graph client pool.

type IGraphResponse

type IGraphResponse interface {
	IsSucceed() bool
	GetLatency() int64
	GetResponseTime() int32
	GetRowSize() int32
}

IGraphResponse graph response, just support some functions to user.

type OutputOption added in v1.1.2

type OutputOption struct {
	Output            string `json:"output"`
	OutputChannelSize int    `json:"output_channel_size"`
}

type PoolOption added in v1.1.2

type PoolOption struct {
	PoolPolicy string `json:"pool_policy"`
	Address    string `json:"address"`
	TimeoutUs  int    `json:"timeout_us"`
	IdleTimeUs int    `json:"idletime_us"`
	MaxSize    int    `json:"max_size"`
	MinSize    int    `json:"min_size"`
	Username   string `json:"username"`
	Password   string `json:"password"`
	Space      string `json:"space"`
}

type PoolPolicy added in v1.1.2

type PoolPolicy string

pool policy

const (
	ConnectionPool PoolPolicy = "connection"
	SessionPool    PoolPolicy = "session"
)

type RetryOption added in v1.1.2

type RetryOption struct {
	RetryTimes      int `json:"retry_times"`
	RetryIntervalUs int `json:"retry_interval_us"`
	RetryTimeoutUs  int `json:"retry_timeout_us"`
}

type SSLOption added in v1.1.2

type SSLOption struct {
	SslCaPemPath     string `json:"ssl_ca_pem_path"`
	SslClientPemPath string `json:"ssl_client_pem_path"`
	SslClientKeyPath string `json:"ssl_client_key_path"`
}

Jump to

Keyboard shortcuts

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