dialer

package
v3.0.3-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: Apache-2.0 Imports: 21 Imported by: 3 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 Login added in v3.0.3

func Login(conn Conn, userID, password string) error

Types

type BehaviorOptions

type BehaviorOptions struct {
	// Priority specifies the priority of the task
	Priority *int
	// Parallelism specifies the parallelism of the task
	Parallelism *int
	// FetchSize specifies the fetchSize of the task
	FetchSize *int
	// Timeout specifies the timeout of the connection.
	Timeout time.Duration

	// Whether to enable load balancing.
	// If true, connect to the address with the fewest connections.
	LoadBalance bool

	// Whether to enable high availability.
	// If true, when the address is unreached, another address in HighAvailabilitySites will be connected.
	EnableHighAvailability bool

	// Available only when EnableHighAvailability is true.
	HighAvailabilitySites []string

	// If true, the address will be reconnected util the server is ready.
	Reconnect bool

	// IsReverseStreaming specifies whether the job is a reverse stream subscription
	IsReverseStreaming bool
	// IsClearSessionMemory specifies whether to clear session memory after the job
	IsClearSessionMemory bool

	// tryReconnectNums specifies the number of times to try reconnecting
	TryReconnectNums *int

	// UsePython specifies whether the session uses a Python parser
	UsePython bool

	// if enable SCRAM login verify
	EnableScram bool
}

BehaviorOptions helps you configure behavior identity. Refer to https://github.com/dolphindb/Tutorials_CN/blob/master/api_protocol.md#254-%E8%A1%8C%E4%B8%BA%E6%A0%87%E8%AF%86 for more details.

func (*BehaviorOptions) GetFetchSize

func (f *BehaviorOptions) GetFetchSize() int

GetFetchSize gets the fetchSize of the task.

func (*BehaviorOptions) GetParallelism

func (f *BehaviorOptions) GetParallelism() int

GetParallelism gets the parallelism of the task.

func (*BehaviorOptions) GetPriority

func (f *BehaviorOptions) GetPriority() int

GetPriority gets the priority of the task.

func (*BehaviorOptions) GetTryReconnectNums added in v3.0.3

func (f *BehaviorOptions) GetTryReconnectNums() int

func (*BehaviorOptions) SetFetchSize

func (f *BehaviorOptions) SetFetchSize(fs int) *BehaviorOptions

SetFetchSize sets the fetchSize of the task.

func (*BehaviorOptions) SetParallelism

func (f *BehaviorOptions) SetParallelism(p int) *BehaviorOptions

SetParallelism sets the parallelism of the task.

func (*BehaviorOptions) SetPriority

func (f *BehaviorOptions) SetPriority(p int) *BehaviorOptions

SetPriority sets the priority of the task.

func (*BehaviorOptions) SetTryReconnectNums added in v3.0.3

func (f *BehaviorOptions) SetTryReconnectNums(n int) *BehaviorOptions

type Conn

type Conn interface {
	net.Conn

	// Connect connects to dolphindb server
	Connect() error
	// GetLocalAddress gets the local address with the connection
	GetLocalAddress() string

	//  RefreshTimeout resets the timeout of the connection
	RefreshTimeout(t time.Duration)
	// GetSession gets the session id of the connection
	GetSession() string
	// Close closes the connection with server
	Close() error
	// IsClosed checks whether the connection is closed
	IsClosed() bool
	// IsConnected checks whether the connection is connected
	IsConnected() bool

	// GetUserID gets the userID
	GetUserID() string
	// SetUserID sets the userID
	SetUserID(userID string)
	// GetPassword gets the password
	GetPassword() string
	// SetPassword sets the password
	SetPassword(password string)

	// RunScript sends script to dolphindb and returns the execution result
	RunScript(s string) (model.DataForm, error)
	// RunFile sends script from a specific file to dolphindb and returns the execution result
	RunFile(path string) (model.DataForm, error)
	// RunFunc sends function request to dolphindb and returns the execution result.
	// See DolphinDB function and command references: https://www.dolphindb.cn/cn/help/130/FunctionsandCommands/FunctionReferences/index.html
	RunFunc(s string, args []model.DataForm) (model.DataForm, error)
	// Upload sends local objects to dolphindb server and the specified variable is generated on the dolphindb
	Upload(vars map[string]model.DataForm) (model.DataForm, error)
	// GetTCPConn returns the TCPConn
	GetTCPConn() *net.TCPConn

	// for inner use
	GetReader() protocol.Reader
	// contains filtered or unexported methods
}

Conn is the interface of DolphinDB conn.

func NewConn

func NewConn(ctx context.Context, addr string, behaviorOpt *BehaviorOptions) (Conn, error)

NewConn instantiates a new connection with the addr. BehaviorOpt will affect every request sent by conn. You can input opts to configure conn.

func NewSimpleConn

func NewSimpleConn(ctx context.Context, address, userID, pwd string) (Conn, error)

NewSimpleConn instantiates a new connection with the addr, which connects to the server and logs in with the userID and pwd.

type ErrorType

type ErrorType int
const (
	IGNORE ErrorType = iota
	UNKNOWN
	NEW_LEADER
	NODE_NOT_AVAIL
	NO_INITIALIZED
	UNEXPECT
)

Directories

Path Synopsis
Package protocol contains functions for zero-copy casting between typed slices and byte slices.
Package protocol contains functions for zero-copy casting between typed slices and byte slices.

Jump to

Keyboard shortcuts

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