ws

package
v3.0.0-...-f4a35bb Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Connect = "conn"
	// websocket
	WSQuery                   = "query"
	WSFetch                   = "fetch"
	WSFetchBlock              = "fetch_block"
	WSFreeResult              = "free_result"
	WSWriteRaw                = "write_raw"
	WSWriteRawBlock           = "write_raw_block"
	WSWriteRawBlockWithFields = "write_raw_block_with_fields"
	WSGetCurrentDB            = "get_current_db"
	WSGetServerInfo           = "get_server_info"
	WSNumFields               = "num_fields"

	// schemaless
	SchemalessWrite = "insert"

	// stmt
	STMTInit         = "init"
	STMTPrepare      = "prepare"
	STMTSetTableName = "set_table_name"
	STMTSetTags      = "set_tags"
	STMTBind         = "bind"
	STMTAddBatch     = "add_batch"
	STMTExec         = "exec"
	STMTClose        = "close"
	STMTGetTagFields = "get_tag_fields"
	STMTGetColFields = "get_col_fields"
	STMTUseResult    = "use_result"
	STMTNumParams    = "stmt_num_params"
	STMTGetParam     = "stmt_get_param"
)
View Source
const (
	SetTagsMessage messageType
	BindMessage
	TMQRawMessage
	RawBlockMessage
	RawBlockMessageWithFields
	BinaryQueryMessage
	FetchRawBlockMessage
)
View Source
const (
	BinaryProtocolVersion1 uint16 = 1
)
View Source
const TaosKey = "taos"

Variables

This section is empty.

Functions

func CloseWs

func CloseWs(session *melody.Session)

Types

type BaseResponse

type BaseResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Action  string `json:"action"`
	ReqID   uint64 `json:"req_id"`
	Timing  int64  `json:"timing"`
	// contains filtered or unexported fields
}

func (*BaseResponse) IsBinary

func (b *BaseResponse) IsBinary() bool

func (*BaseResponse) IsNull

func (b *BaseResponse) IsNull() bool

func (*BaseResponse) SetAction

func (b *BaseResponse) SetAction(action string)

func (*BaseResponse) SetBinary

func (b *BaseResponse) SetBinary(binary bool)

func (*BaseResponse) SetCode

func (b *BaseResponse) SetCode(code int)

func (*BaseResponse) SetMessage

func (b *BaseResponse) SetMessage(message string)

func (*BaseResponse) SetNull

func (b *BaseResponse) SetNull(null bool)

func (*BaseResponse) SetReqID

func (b *BaseResponse) SetReqID(reqID uint64)

func (*BaseResponse) SetTiming

func (b *BaseResponse) SetTiming(timing int64)

type BinaryResponse

type BinaryResponse struct {
	BaseResponse
	Data []byte
}

type ConnRequest

type ConnRequest struct {
	ReqID    uint64 `json:"req_id"`
	User     string `json:"user"`
	Password string `json:"password"`
	DB       string `json:"db"`
	Mode     *int   `json:"mode"`
}

type FetchBlockRequest

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

type FetchRequest

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

type FetchResponse

type FetchResponse struct {
	BaseResponse
	ID        uint64 `json:"id"`
	Completed bool   `json:"completed"`
	Lengths   []int  `json:"lengths"`
	Rows      int    `json:"rows"`
}

type FreeResultRequest

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

type GetCurrentDBResponse

type GetCurrentDBResponse struct {
	BaseResponse
	DB string `json:"db"`
}

type GetServerInfoResponse

type GetServerInfoResponse struct {
	BaseResponse
	Info string `json:"info"`
}

type NumFieldsRequest

type NumFieldsRequest struct {
	ReqID    uint64 `json:"req_id"`
	ResultID uint64 `json:"result_id"`
}

type NumFieldsResponse

type NumFieldsResponse struct {
	BaseResponse
	NumFields int `json:"num_fields"`
}

type QueryRequest

type QueryRequest struct {
	ReqID uint64 `json:"req_id"`
	Sql   string `json:"sql"`
}

type QueryResponse

type QueryResponse struct {
	BaseResponse
	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   jsontype.JsonUint8 `json:"fields_types"`
	FieldsLengths []int64            `json:"fields_lengths"`
	Precision     int                `json:"precision"`
}

type QueryResult

type QueryResult struct {
	TaosResult  unsafe.Pointer
	FieldsCount int
	Header      *wrapper.RowsHeader
	Lengths     []int
	Size        int
	Block       unsafe.Pointer

	sync.Mutex
	// contains filtered or unexported fields
}

type QueryResultHolder

type QueryResultHolder struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewQueryResultHolder

func NewQueryResultHolder() *QueryResultHolder

func (*QueryResultHolder) Add

func (h *QueryResultHolder) Add(result *QueryResult) uint64

func (*QueryResultHolder) FreeAll

func (h *QueryResultHolder) FreeAll()

func (*QueryResultHolder) FreeResultByID

func (h *QueryResultHolder) FreeResultByID(index uint64)

func (*QueryResultHolder) Get

func (h *QueryResultHolder) Get(index uint64) *QueryResult

type Request

type Request struct {
	ReqID  uint64          `json:"req_id"`
	Action string          `json:"action"`
	Args   json.RawMessage `json:"args"`
}

type RequestID

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

type Response

type Response interface {
	SetCode(code int)
	SetMessage(message string)
	SetAction(action string)
	SetReqID(reqID uint64)
	SetTiming(timing int64)
	SetBinary(b bool)
	IsBinary() bool
	SetNull(b bool)
	IsNull() bool
}

type SchemalessWriteRequest

type SchemalessWriteRequest struct {
	ReqID     uint64 `json:"req_id"`
	Protocol  int    `json:"protocol"`
	Precision string `json:"precision"`
	TTL       int    `json:"ttl"`
	Data      string `json:"data"`
}

type SchemalessWriteResponse

type SchemalessWriteResponse struct {
	BaseResponse
	AffectedRows int   `json:"affected_rows"`
	TotalRows    int32 `json:"total_rows"`
}

type StmtAddBatchRequest

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

type StmtAddBatchResponse

type StmtAddBatchResponse struct {
	BaseResponse
	StmtID uint64 `json:"stmt_id"`
}

type StmtBindRequest

type StmtBindRequest struct {
	ReqID   uint64          `json:"req_id"`
	StmtID  uint64          `json:"stmt_id"`
	Columns json.RawMessage `json:"columns"`
}

type StmtBindResponse

type StmtBindResponse struct {
	BaseResponse
	StmtID uint64 `json:"stmt_id"`
}

type StmtCloseRequest

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

type StmtCloseResponse

type StmtCloseResponse struct {
	BaseResponse
	StmtID uint64 `json:"stmt_id,omitempty"`
}

type StmtExecRequest

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

type StmtExecResponse

type StmtExecResponse struct {
	BaseResponse
	StmtID   uint64 `json:"stmt_id"`
	Affected int    `json:"affected"`
}

type StmtGetColFieldsRequest

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

type StmtGetColFieldsResponse

type StmtGetColFieldsResponse struct {
	BaseResponse
	StmtID uint64                  `json:"stmt_id"`
	Fields []*stmtCommon.StmtField `json:"fields"`
}

type StmtGetParamRequest

type StmtGetParamRequest struct {
	ReqID  uint64 `json:"req_id"`
	StmtID uint64 `json:"stmt_id"`
	Index  int    `json:"index"`
}

type StmtGetParamResponse

type StmtGetParamResponse struct {
	BaseResponse
	StmtID   uint64 `json:"stmt_id"`
	Index    int    `json:"index"`
	DataType int    `json:"data_type"`
	Length   int    `json:"length"`
}

type StmtGetTagFieldsRequest

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

type StmtGetTagFieldsResponse

type StmtGetTagFieldsResponse struct {
	BaseResponse
	StmtID uint64                  `json:"stmt_id"`
	Fields []*stmtCommon.StmtField `json:"fields,omitempty"`
}

type StmtHolder

type StmtHolder struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewStmtHolder

func NewStmtHolder() *StmtHolder

func (*StmtHolder) Add

func (h *StmtHolder) Add(item *StmtItem) uint64

func (*StmtHolder) FreeAll

func (h *StmtHolder) FreeAll()

func (*StmtHolder) FreeStmtByID

func (h *StmtHolder) FreeStmtByID(index uint64)

func (*StmtHolder) Get

func (h *StmtHolder) Get(index uint64) *StmtItem

type StmtInitResponse

type StmtInitResponse struct {
	BaseResponse
	StmtID uint64 `json:"stmt_id"`
}

type StmtItem

type StmtItem struct {
	sync.Mutex
	// contains filtered or unexported fields
}

type StmtNumParamsRequest

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

type StmtNumParamsResponse

type StmtNumParamsResponse struct {
	BaseResponse
	StmtID    uint64 `json:"stmt_id"`
	NumParams int    `json:"num_params"`
}

type StmtPrepareRequest

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

type StmtPrepareResponse

type StmtPrepareResponse struct {
	BaseResponse
	StmtID   uint64 `json:"stmt_id"`
	IsInsert bool   `json:"is_insert"`
}

type StmtSetTableNameRequest

type StmtSetTableNameRequest struct {
	ReqID  uint64 `json:"req_id"`
	StmtID uint64 `json:"stmt_id"`
	Name   string `json:"name"`
}

type StmtSetTableNameResponse

type StmtSetTableNameResponse struct {
	BaseResponse
	StmtID uint64 `json:"stmt_id"`
}

type StmtSetTagsRequest

type StmtSetTagsRequest struct {
	ReqID  uint64          `json:"req_id"`
	StmtID uint64          `json:"stmt_id"`
	Tags   json.RawMessage `json:"tags"`
}

type StmtSetTagsResponse

type StmtSetTagsResponse struct {
	BaseResponse
	StmtID uint64 `json:"stmt_id"`
}

type StmtUseResultRequest

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

type StmtUseResultResponse

type StmtUseResultResponse struct {
	BaseResponse
	StmtID        uint64             `json:"stmt_id"`
	ResultID      uint64             `json:"result_id"`
	FieldsCount   int                `json:"fields_count"`
	FieldsNames   []string           `json:"fields_names"`
	FieldsTypes   jsontype.JsonUint8 `json:"fields_types"`
	FieldsLengths []int64            `json:"fields_lengths"`
	Precision     int                `json:"precision"`
}

type VersionResponse

type VersionResponse struct {
	BaseResponse
	Version string `json:"version"`
}

type WSStmtErrorResp

type WSStmtErrorResp struct {
	BaseResponse
	StmtID uint64 `json:"stmt_id"`
}

Jump to

Keyboard shortcuts

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