protocol

package
v0.0.0-...-3e7cef7 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewChannelEndpoints

func NewChannelEndpoints() (DriverEndpoint, EngineEndpoint)

NewChannelEndpoints instanciates a Driver and Engine channel endpoints

func UnlimitedRowsChannel

func UnlimitedRowsChannel(bufferThis chan message, firstMessage message) chan []string

UnlimitedRowsChannel buffers incomming message from bufferThis channel and forward them to returned channel. ONLY CREATED CHANNEL IS CLOSED HERE.

Types

type ChannelDriverConn

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

ChannelDriverConn implements DriverConn for channel backend

func (*ChannelDriverConn) Close

func (cdc *ChannelDriverConn) Close()

Close method closes the connection to RamSQL server

func (*ChannelDriverConn) ReadResult

func (cdc *ChannelDriverConn) ReadResult() (lastInsertedID int64, rowsAffected int64, err error)

ReadResult when Exec has been used

func (*ChannelDriverConn) ReadRows

func (cdc *ChannelDriverConn) ReadRows() (chan []string, error)

ReadRows when Query has been used

func (*ChannelDriverConn) WriteExec

func (cdc *ChannelDriverConn) WriteExec(statement string) error

WriteExec allows client to manipulate the RamSQL server

func (*ChannelDriverConn) WriteQuery

func (cdc *ChannelDriverConn) WriteQuery(query string) error

WriteQuery allows client to query the RamSQL server

type ChannelDriverEndpoint

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

ChannelDriverEndpoint implements DriverEndpoint for channel backend

func (*ChannelDriverEndpoint) New

func (cde *ChannelDriverEndpoint) New(uri string) (DriverConn, error)

New method creates a new DriverConn from DriverEndpoint

type ChannelEngineConn

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

ChannelEngineConn implements EngineConn for channel backend

func (*ChannelEngineConn) ReadStatement

func (cec *ChannelEngineConn) ReadStatement() (string, error)

ReadStatement get SQL statements from client

func (*ChannelEngineConn) WriteError

func (cec *ChannelEngineConn) WriteError(err error) error

WriteError when error occurs

func (*ChannelEngineConn) WriteResult

func (cec *ChannelEngineConn) WriteResult(lastInsertedID int64, rowsAffected int64) error

WriteResult is used to answer to statements other than SELECT

func (*ChannelEngineConn) WriteRow

func (cec *ChannelEngineConn) WriteRow(row []string) error

WriteRow must be called after WriteRowHeader and before WriteRowEnd

func (*ChannelEngineConn) WriteRowEnd

func (cec *ChannelEngineConn) WriteRowEnd() error

WriteRowEnd indicates that query is done

func (*ChannelEngineConn) WriteRowHeader

func (cec *ChannelEngineConn) WriteRowHeader(header []string) error

WriteRowHeader indicates that rows are coming next

type ChannelEngineEndpoint

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

ChannelEngineEndpoint implements EngineEndpoint for channel backend

func (*ChannelEngineEndpoint) Accept

func (cee *ChannelEngineEndpoint) Accept() (EngineConn, error)

Accept read from new channels channel and return an EngineConn

func (*ChannelEngineEndpoint) Close

func (cee *ChannelEngineEndpoint) Close()

Close close the connection with client

type DriverConn

type DriverConn interface {
	WriteQuery(query string) error
	WriteExec(stmt string) error
	ReadResult() (lastInsertedID int64, rowsAffected int64, err error)
	ReadRows() (chan []string, error)
	Close()
}

DriverConn is a networking helper hiding implementation either with channels or network sockets.

type DriverEndpoint

type DriverEndpoint interface {
	New(string) (DriverConn, error)
}

DriverEndpoint instanciates either - an Engine and communication channels - a network socket to connect to an existing RamSQL engine

func NewChannelDriverEndpoint

func NewChannelDriverEndpoint(channel chan<- chan message) DriverEndpoint

NewChannelDriverEndpoint initialize a DriverEndpoint with channel backend

type EngineConn

type EngineConn interface {
	ReadStatement() (string, error)
	WriteResult(lastInsertedID int64, rowsAffected int64) error
	WriteError(err error) error
	WriteRowHeader(header []string) error
	WriteRow(row []string) error
	WriteRowEnd() error
}

EngineConn is a networking helper hiding implementation either with channels or network sockets.

func NewChannelEngineConn

func NewChannelEngineConn(newConn chan message) EngineConn

NewChannelEngineConn initializes a new EngineConn with channel backend

type EngineEndpoint

type EngineEndpoint interface {
	Accept() (EngineConn, error)
	Close()
}

EngineEndpoint is the query entrypoint of RamSQL engine.

func NewChannelEngineEndpoint

func NewChannelEngineEndpoint(channel <-chan chan message) EngineEndpoint

NewChannelEngineEndpoint initialize a EngineEndpoint with channel backend

Jump to

Keyboard shortcuts

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