cbitSqlDriver

package
v2.16.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CbitSqlDriver

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

type CbitSqlInstance

type CbitSqlInstance struct {
	// contains filtered or unexported fields
}
var (
	CbitSqlInstanceApp CbitSqlInstance
)

func (*CbitSqlInstance) Close

func (r *CbitSqlInstance) Close(name string) error

Close 关闭链接

func (*CbitSqlInstance) Connect

func (r *CbitSqlInstance) Connect(
	name, path string,
	receiveMsg func(instanceName, clientName string, propertyMessage []byte) ([]byte, error),
	heart *websocketPool.Heart,
	timeout *websocketPool.MessageTimeout,
) (*websocketPool.Client, error)

Connect 创建链接

func (CbitSqlInstance) New

func (CbitSqlInstance) New(
	name, addr, username, password,
	pemPublicKeyBase64, aesKeySail string,
	needEncrypt bool,
	wcp *websocketPool.ClientPool,
) (*CbitSqlInstance, error)

New 实例化:自研数据库链接实例

func (*CbitSqlInstance) Parse

func (r *CbitSqlInstance) Parse(name string, resBasic *ResBasic) (*ResData, error)

Parse 解析消息

func (*CbitSqlInstance) Reconnect

func (r *CbitSqlInstance) Reconnect(name string) (*websocketPool.Client, error)

Reconnect 重连

func (*CbitSqlInstance) Send

func (r *CbitSqlInstance) Send(name string, reqDataStr string) ([]byte, error)

Send 发送消息

func (*CbitSqlInstance) SetSession

func (r *CbitSqlInstance) SetSession(name, session string) error

SetSession 设置session

type ClientRuntime

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

type ReqBasic

type ReqBasic struct {
	Uuid    string `json:"uuid"`
	Session string `json:"session"`
	Data    string `json:"data"`
	State   int32  `json:"state"`
}

func (ReqBasic) New

func (ReqBasic) New(reqData, session string) *ReqBasic

New 实例化

func (*ReqBasic) ToJson

func (r *ReqBasic) ToJson() ([]byte, error)

ToJson 序列化:json

type ReqData

type ReqData struct {
	Sql          string         `json:"sql"`
	SessionId    int32          `json:"session_id"`
	AutoCommit   bool           `json:"auto_commit"`
	FetchSize    int32          `json:"fetch_size"`
	TaskId       int32          `json:"task_id"`
	QueryTimeout int32          `json:"query_timeout"`
	UserName     string         `json:"user_name"`
	Password     string         `json:"password"`
	SendType     string         `json:"send_type"`
	Param        []ReqDataParam `json:"param"`
	// contains filtered or unexported fields
}

func (ReqData) NewAuth

func (ReqData) NewAuth(aes *symmetric.Aes, pemPublicKeyBase64, username, password string) *reqDataAuth

NewAuth 实例化:认证

func (*ReqData) NewQuery

func (r *ReqData) NewQuery(aes *symmetric.Aes, sql string) *reqDataQuery

NewQuery 实例化:查询

type ReqDataParam

type ReqDataParam struct {
	ParamTypes  string `json:"param_types"`
	ParamValues string `json:"param_values"`
}

type ResBasic

type ResBasic struct {
	Uuid    string `json:"uuid"`
	Session string `json:"session"`
	Data    string `json:"data,omitempty"`
	State   int32  `json:"state"`
}

func (ResBasic) New

func (r ResBasic) New(jsonByte []byte) (*ResBasic, error)

func (ResBasic) NewAuth

func (r ResBasic) NewAuth(jsonByte []byte) (*ResBasic, error)

type ResData

type ResData struct {
	State        int32  `json:"state"`
	Msg          string `json:"msg"`
	Count        []uint `json:"count"`
	Data         any    `json:"data"`
	ColumnName   any    `json:"column_name"`
	QueryTimeout int32  `json:"query_timeout"`
	Session      int32  `json:"session"`
}

func (ResData) New

func (r ResData) New(jsonByte []byte) (*ResData, error)

Jump to

Keyboard shortcuts

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