wire

package
v0.0.0-...-6355219 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MAX_FRAGMENT_SIZE = 1024 * 1024 * 64

Functions

func GetRemoteAddr

func GetRemoteAddr(x context.Context) net.Addr

func WritePacket

func WritePacket(w io.Writer, tag string, dat []byte) error

func WritePacketJSON

func WritePacketJSON(w io.Writer, tag string, payload any) error

func WriteValue

func WriteValue(w io.Writer, value any) (int, error)

func WriteValues

func WriteValues(w io.Writer, values ...any) (int, error)

Types

type AuthResult

type AuthResult struct {
	UserId   int64  `json:"user_id"`
	VFSName  string `json:"vfs_name"`
	User     string `json:"user"`
	DbName   string `json:"db_name"`
	Super    bool   `json:"super"`
	Readonly bool   `json:"readonly"`
}

type Column

type Column struct {
	Name string   `json:"column"`
	Type Datatype `json:"type"`
}

type DataRows

type DataRows struct {
	Id          int32
	OffsetStart int64
	Rows        [][]any
}

func ReadDataRows

func ReadDataRows(r io.Reader) (*DataRows, error)

func (*DataRows) WriteTo

func (rs *DataRows) WriteTo(w io.Writer) (int64, error)

type Datatype

type Datatype uint32
const (
	INTEGER Datatype = 1
	FLOAT   Datatype = 2
	TEXT    Datatype = 3
	BLOB    Datatype = 4
	NULL    Datatype = 5
)

type Packet

type Packet struct {
	Flag byte
	Tag  string
	Data []byte
}

func ReadPacket

func ReadPacket(r io.Reader) (*Packet, error)

func (*Packet) FinalFragment

func (p *Packet) FinalFragment() bool

func (*Packet) Fragment

func (p *Packet) Fragment() bool

func (*Packet) SetFinalFragment

func (p *Packet) SetFinalFragment(v bool)

func (*Packet) SetFragment

func (p *Packet) SetFragment(v bool)

type Portal

type Portal struct {
	Id           int32     `json:"id"`
	Columns      []*Column `json:"columns"`
	RowsAffected int64     `json:"rows_affected"`
	Offset       int64     `json:"-"`
}

type ReadWriter

type ReadWriter interface {
	Reader
	Writer
	io.Closer
}

func NewReadWriter

func NewReadWriter(rw io.ReadWriter) ReadWriter

func NewReadWriterAsync

func NewReadWriterAsync(rw io.ReadWriter) ReadWriter

type Reader

type Reader interface {
	ReadPacket() (*Packet, error)
}

func NewReader

func NewReader(r io.Reader) Reader

type ReqAuth

type ReqAuth struct {
	User   string `json:"user"`
	Pwd    string `json:"pwd"`
	DbName string `json:"db_name"`
}

type ReqBind

type ReqBind struct {
	Id          int32 `json:"id"` /* prepared-statement id */
	ParamsCount int   `json:"params_count"`
	Params      []any `json:"params"`
}

type ReqId

type ReqId struct {
	Id int32 `json:"id"`
}

type ReqQueryFetch

type ReqQueryFetch struct {
	Id       int32  `json:"id"`
	CountMax int    `json:"count_max"`
	Encoding string `json:"encoding"`
}

type Result

type Result struct {
	LastInsertId int64 `json:"last_insert_id"`
	RowsAffected int64 `json:"rows_affected"`
}

type Stmt

type Stmt struct {
	Id          int32    `json:"id"`
	ParamsCount int      `json:"params_count"`
	Cmds        []string `json:"cmds"`
}

type ValueReader

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

func (*ValueReader) ReadInt64

func (vr *ValueReader) ReadInt64(r io.Reader) (int64, error)

func (*ValueReader) ReadString

func (vr *ValueReader) ReadString(r io.Reader) (string, error)

func (*ValueReader) ReadValue

func (vr *ValueReader) ReadValue(r io.Reader) (byte, any, error)

type Writer

type Writer interface {
	WritePacket(string, []byte) error
	WritePacketJSON(string, any) error
}

func NewWriter

func NewWriter(w io.Writer) Writer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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