util

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidDatabaseInstance = errors.New("invalid database instance")

ErrInvalidDatabaseInstance is returned when a malformed database instance is supplied.

Functions

func GetMockAddress

func GetMockAddress() string

GetMockAddress is used by the tests to determine the address of the Google API mock.

func ParseInstance

func ParseInstance(instance string) (map[string]string, error)

ParseInstance is used to split the components out of a fully qualified database instance.

Types

type CancellableConnection

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

CancellableConnection is a context.Context aware network connection.

func MakeCancellable

func MakeCancellable(ctx context.Context, conn net.Conn) *CancellableConnection

MakeCancellable converts a net.Conn into a cancellable connection.

func (*CancellableConnection) Close

func (cc *CancellableConnection) Close() error

Close closes the connection.

func (*CancellableConnection) LocalAddr

func (cc *CancellableConnection) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (*CancellableConnection) Read

func (cc *CancellableConnection) Read(p []byte) (int, error)

Read reads an array of bytes from the connection.

func (*CancellableConnection) RemoteAddr

func (cc *CancellableConnection) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (*CancellableConnection) SetDeadline

func (cc *CancellableConnection) SetDeadline(t time.Time) error

SetDeadline sets the read and write deadlines associated with the connection.

func (*CancellableConnection) SetReadDeadline

func (cc *CancellableConnection) SetReadDeadline(t time.Time) error

SetReadDeadline sets the deadline for future Read calls and any currently-blocked Read call.

func (*CancellableConnection) SetWriteDeadline

func (cc *CancellableConnection) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the deadline for future Write calls and any currently-blocked Write call.

func (*CancellableConnection) Write

func (cc *CancellableConnection) Write(p []byte) (int, error)

Write writes an array of bytes to the connection.

Jump to

Keyboard shortcuts

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