multigoroutinetable

package
v1.30.24 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoroutineStatus

type GoroutineStatus struct {
	// goroutine index
	GoroutineIndex int
	// the number of records that failed to be sent
	FailedRows int
	// the number of records that have been sent
	SentRows int
	// Deprecated.
	UnSentRows int
	// the number of unsent records
	UnsentRows int
}

GoroutineStatus records the status of goroutine.

func (*GoroutineStatus) String

func (ts *GoroutineStatus) String() string

String returns the status of goroutines in string format.

type MultiGoroutineTable

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

MultiGoroutineTable is used to insert data into a table with multiple goroutines.

func NewMultiGoroutineTable

func NewMultiGoroutineTable(opt *Option) (*MultiGoroutineTable, error)

NewMultiGoroutineTable instantiates an instance of MultiGoroutineTable with MultiGoroutineTableOption.

func (*MultiGoroutineTable) GetStatus

func (mtt *MultiGoroutineTable) GetStatus() *Status

GetStatus returns the status for the instance of MultiGoroutineTable.

func (*MultiGoroutineTable) GetUnwrittenData

func (mtt *MultiGoroutineTable) GetUnwrittenData() [][]interface{}

GetUnwrittenData returns the total of unsent data and failed data.

func (*MultiGoroutineTable) Insert

func (mtt *MultiGoroutineTable) Insert(args ...interface{}) error

Insert inserts data into the table. The length of args must be equal with the number of columns of the table.

func (*MultiGoroutineTable) InsertUnwrittenData

func (mtt *MultiGoroutineTable) InsertUnwrittenData(records [][]interface{}) error

InsertUnwrittenData inserts data into the table. You can insert data obtained from GetUnwrittenData with this function.

func (*MultiGoroutineTable) WaitForGoroutineCompletion

func (mtt *MultiGoroutineTable) WaitForGoroutineCompletion()

WaitForGoroutineCompletion waits for the data to be sent completely and exits the MultiGoroutineTable. An error will be thrown if you call Insert or InsertUnwrittenData after the MultiGoroutineTable exits.

type Option

type Option struct {
	// database path or database handle
	Database string
	// name of the table
	TableName string
	// address of the dolphindb server
	Address string
	// user id
	UserID string
	// password of the user
	Password string
	// the amount of data processed at one time
	BatchSize int
	// timeout. unit: millisecond
	Throttle int
	// the number of coroutine
	GoroutineCount int
	// the partitioning column name
	PartitionCol string
}

Option is used to configure MultiGoroutineTable.

type Status

type Status struct {
	// errMsg of MultiGoroutineTable
	ErrMsg string
	// the number of records that failed to be sent
	FailedRows int
	// the number of records that have been sent
	SentRows int
	// Deprecated.
	UnSentRows int
	// the number of unsent records
	UnsentRows int
	// check whether the MultiGoroutineTable finished
	IsExit bool
	// Deprecated.
	GoroutineStatusList []*GoroutineStatus
	// list the status of goroutines
	GoroutineStatus []*GoroutineStatus
}

Status is used to store the status of MultiGoroutineTable.

func (*Status) String

func (s *Status) String() string

String returns the status of goroutines in string format.

Jump to

Keyboard shortcuts

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