taosWS

package
v3.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: MIT Imports: 26 Imported by: 1

Documentation

Index

Constants

View Source
const (
	WSConnect    = "conn"
	WSFreeResult = "free_result"

	STMTInit         = "init"
	STMTPrepare      = "prepare"
	STMTAddBatch     = "add_batch"
	STMTExec         = "exec"
	STMTClose        = "close"
	STMTGetColFields = "get_col_fields"
	STMTUseResult    = "use_result"
)
View Source
const (
	BinaryQueryMessage   uint64 = 6
	FetchRawBlockMessage uint64 = 7
)
View Source
const (
	BindMessage = 2
)

Variables

View Source
var (
	NotQueryError    = errors.New("sql is an update statement not a query statement")
	ReadTimeoutError = errors.New("read timeout")
)
View Source
var (
	ErrInvalidDSNUnescaped = &errors.TaosError{Code: 0xffff, ErrStr: "invalid DSN: did you forget to escape a param value?"}
	ErrInvalidDSNAddr      = &errors.TaosError{Code: 0xffff, ErrStr: "invalid DSN: network address not terminated (missing closing brace)"}
	ErrInvalidDSNPort      = &errors.TaosError{Code: 0xffff, ErrStr: "invalid DSN: network port is not a valid number"}
	ErrInvalidDSNNoSlash   = &errors.TaosError{Code: 0xffff, ErrStr: "invalid DSN: missing the slash separating the database name"}
)

Functions

func NewConnector added in v3.6.0

func NewConnector(cfg *Config) (driver.Connector, error)

NewConnector returns new driver.Connector.

func WriteUint16 added in v3.5.6

func WriteUint16(buffer *bytes.Buffer, v uint16)

func WriteUint32 added in v3.5.6

func WriteUint32(buffer *bytes.Buffer, v uint32)

func WriteUint64 added in v3.5.2

func WriteUint64(buffer *bytes.Buffer, v uint64)

Types

type BadConnError

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

func NewBadConnError

func NewBadConnError(err error) *BadConnError

func NewBadConnErrorWithCtx

func NewBadConnErrorWithCtx(err error, ctx string) *BadConnError

func (*BadConnError) Error

func (e *BadConnError) Error() string

func (*BadConnError) Unwrap

func (*BadConnError) Unwrap() error

type Config added in v3.6.0

type Config struct {
	User              string // Username
	Passwd            string // Password (requires User)
	Net               string // Network type
	Addr              string // Network address (requires Net)
	Port              int
	DbName            string            // Database name
	Params            map[string]string // Connection parameters
	InterpolateParams bool              // Interpolate placeholders into query string
	Token             string            // cloud platform Token
	EnableCompression bool              // Enable write compression
	ReadTimeout       time.Duration     // read message timeout
	WriteTimeout      time.Duration     // write message timeout
}

Config is a configuration parsed from a DSN string. If a new Config is created instead of being parsed from a DSN string, the NewConfig function should be used, which sets default values.

func NewConfig added in v3.6.0

func NewConfig() *Config

NewConfig creates a new Config and sets default values.

func ParseDSN added in v3.6.0

func ParseDSN(dsn string) (cfg *Config, err error)

ParseDSN parses the DSN string to a Config

type Stmt added in v3.5.2

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

func (*Stmt) CheckNamedValue added in v3.5.2

func (stmt *Stmt) CheckNamedValue(v *driver.NamedValue) error

func (*Stmt) Close added in v3.5.2

func (stmt *Stmt) Close() error

func (*Stmt) Exec added in v3.5.2

func (stmt *Stmt) Exec(args []driver.Value) (driver.Result, error)

func (*Stmt) NumInput added in v3.5.2

func (stmt *Stmt) NumInput() int

func (*Stmt) Query added in v3.5.2

func (stmt *Stmt) Query(args []driver.Value) (driver.Rows, error)

type StmtAddBatchRequest added in v3.5.2

type StmtAddBatchRequest struct {
	ReqID  uint64 `json:"req_id"`
	StmtID uint64 `json:"stmt_id"`
}

type StmtAddBatchResponse added in v3.5.2

type StmtAddBatchResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Action  string `json:"action"`
	ReqID   uint64 `json:"req_id"`
	Timing  int64  `json:"timing"`
	StmtID  uint64 `json:"stmt_id"`
}

type StmtBindResponse added in v3.5.2

type StmtBindResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Action  string `json:"action"`
	ReqID   uint64 `json:"req_id"`
	Timing  int64  `json:"timing"`
	StmtID  uint64 `json:"stmt_id"`
}

type StmtCloseRequest added in v3.5.2

type StmtCloseRequest struct {
	ReqID  uint64 `json:"req_id"`
	StmtID uint64 `json:"stmt_id"`
}

type StmtCloseResponse added in v3.5.2

type StmtCloseResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Action  string `json:"action"`
	ReqID   uint64 `json:"req_id"`
	Timing  int64  `json:"timing"`
	StmtID  uint64 `json:"stmt_id,omitempty"`
}

type StmtExecRequest added in v3.5.2

type StmtExecRequest struct {
	ReqID  uint64 `json:"req_id"`
	StmtID uint64 `json:"stmt_id"`
}

type StmtExecResponse added in v3.5.2

type StmtExecResponse struct {
	Code     int    `json:"code"`
	Message  string `json:"message"`
	Action   string `json:"action"`
	ReqID    uint64 `json:"req_id"`
	Timing   int64  `json:"timing"`
	StmtID   uint64 `json:"stmt_id"`
	Affected int    `json:"affected"`
}

type StmtGetColFieldsRequest added in v3.5.2

type StmtGetColFieldsRequest struct {
	ReqID  uint64 `json:"req_id"`
	StmtID uint64 `json:"stmt_id"`
}

type StmtGetColFieldsResponse added in v3.5.2

type StmtGetColFieldsResponse struct {
	Code    int                     `json:"code"`
	Message string                  `json:"message"`
	Action  string                  `json:"action"`
	ReqID   uint64                  `json:"req_id"`
	Timing  int64                   `json:"timing"`
	StmtID  uint64                  `json:"stmt_id"`
	Fields  []*stmtCommon.StmtField `json:"fields"`
}

type StmtInitReq added in v3.5.2

type StmtInitReq struct {
	ReqID uint64 `json:"req_id"`
}

type StmtInitResp added in v3.5.2

type StmtInitResp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Action  string `json:"action"`
	ReqID   uint64 `json:"req_id"`
	Timing  int64  `json:"timing"`
	StmtID  uint64 `json:"stmt_id"`
}

type StmtPrepareRequest added in v3.5.2

type StmtPrepareRequest struct {
	ReqID  uint64 `json:"req_id"`
	StmtID uint64 `json:"stmt_id"`
	SQL    string `json:"sql"`
}

type StmtPrepareResponse added in v3.5.2

type StmtPrepareResponse struct {
	Code     int    `json:"code"`
	Message  string `json:"message"`
	Action   string `json:"action"`
	ReqID    uint64 `json:"req_id"`
	Timing   int64  `json:"timing"`
	StmtID   uint64 `json:"stmt_id"`
	IsInsert bool   `json:"is_insert"`
}

type StmtUseResultRequest added in v3.5.2

type StmtUseResultRequest struct {
	ReqID  uint64 `json:"req_id"`
	StmtID uint64 `json:"stmt_id"`
}

type StmtUseResultResponse added in v3.5.2

type StmtUseResultResponse struct {
	Code          int      `json:"code"`
	Message       string   `json:"message"`
	Action        string   `json:"action"`
	ReqID         uint64   `json:"req_id"`
	Timing        int64    `json:"timing"`
	StmtID        uint64   `json:"stmt_id"`
	ResultID      uint64   `json:"result_id"`
	FieldsCount   int      `json:"fields_count"`
	FieldsNames   []string `json:"fields_names"`
	FieldsTypes   []uint8  `json:"fields_types"`
	FieldsLengths []int64  `json:"fields_lengths"`
	Precision     int      `json:"precision"`
}

type TDengineDriver

type TDengineDriver struct{}

TDengineDriver is exported to make the driver directly accessible. In general the driver is used via the database/sql package.

func (TDengineDriver) Open

func (d TDengineDriver) Open(dsn string) (driver.Conn, error)

Open new Connection. the DSN string is formatted

func (TDengineDriver) OpenConnector added in v3.6.0

func (d TDengineDriver) OpenConnector(dsn string) (driver.Connector, error)

OpenConnector implements driver.DriverContext.

type WSAction

type WSAction struct {
	Action string          `json:"action"`
	Args   json.RawMessage `json:"args"`
}

type WSConnectReq

type WSConnectReq struct {
	ReqID    uint64 `json:"req_id"`
	User     string `json:"user"`
	Password string `json:"password"`
	DB       string `json:"db"`
}

type WSConnectResp

type WSConnectResp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Action  string `json:"action"`
	ReqID   uint64 `json:"req_id"`
	Timing  int64  `json:"timing"`
}

type WSFetchBlockReq

type WSFetchBlockReq struct {
	ReqID uint64 `json:"req_id"`
	ID    uint64 `json:"id"`
}

type WSFetchReq

type WSFetchReq struct {
	ReqID uint64 `json:"req_id"`
	ID    uint64 `json:"id"`
}

type WSFetchResp

type WSFetchResp struct {
	Code      int    `json:"code"`
	Message   string `json:"message"`
	Action    string `json:"action"`
	ReqID     uint64 `json:"req_id"`
	Timing    int64  `json:"timing"`
	ID        uint64 `json:"id"`
	Completed bool   `json:"completed"`
	Lengths   []int  `json:"lengths"`
	Rows      int    `json:"rows"`
}

type WSFreeResultReq

type WSFreeResultReq struct {
	ReqID uint64 `json:"req_id"`
	ID    uint64 `json:"id"`
}

type WSQueryReq

type WSQueryReq struct {
	ReqID uint64 `json:"req_id"`
	SQL   string `json:"sql"`
}

type WSQueryResp

type WSQueryResp struct {
	Code          int      `json:"code"`
	Message       string   `json:"message"`
	Action        string   `json:"action"`
	ReqID         uint64   `json:"req_id"`
	Timing        int64    `json:"timing"`
	ID            uint64   `json:"id"`
	IsUpdate      bool     `json:"is_update"`
	AffectedRows  int      `json:"affected_rows"`
	FieldsCount   int      `json:"fields_count"`
	FieldsNames   []string `json:"fields_names"`
	FieldsTypes   []uint8  `json:"fields_types"`
	FieldsLengths []int64  `json:"fields_lengths"`
	Precision     int      `json:"precision"`
}

Jump to

Keyboard shortcuts

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