cockroach

package
v0.1.0-dev.23 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TCPProtocol    = "tcp"  // TCPProtocol is the protocol for TCP connections.
	SocketProtocol = "unix" // SocketProtocol is the protocol for unix socket connections.
)

Variables

View Source
var ErrTypeNotFound = errors.New("type not found") // ErrTypeNotFound is returned when a type is not found.

Functions

func GetTypeFromName

func GetTypeFromName(name string) (data.Type, error)

GetTypeFromName returns a type from its name.

Types

type ArrayType

type ArrayType struct {
	data.BaseValueType
	// contains filtered or unexported fields
}

ArrayType is a type for array.

func (*ArrayType) GetTypeKind

func (t *ArrayType) GetTypeKind() data.Kind

GetTypeKind returns the kind of the type.

func (*ArrayType) GetTypeName

func (t *ArrayType) GetTypeName() string

GetTypeName returns the name of the type.

func (*ArrayType) GetTypeSize

func (t *ArrayType) GetTypeSize() uint64

func (*ArrayType) GetValue

func (t *ArrayType) GetValue() any

GetValue returns the value stored in the receiver.

func (*ArrayType) GetValueSize

func (t *ArrayType) GetValueSize() uint64

GetValueSize returns the size of the value in bytes.

func (*ArrayType) Parse

func (t *ArrayType) Parse(v any) error

Parse parses the value and stores it in the receiver.

type BitType

type BitType struct {
	data.BaseValueType
	// contains filtered or unexported fields
}

func (*BitType) GetTypeKind

func (t *BitType) GetTypeKind() data.Kind

func (*BitType) GetTypeName

func (t *BitType) GetTypeName() string

func (*BitType) GetTypeSize

func (t *BitType) GetTypeSize() uint64

func (*BitType) GetValue

func (t *BitType) GetValue() any

func (*BitType) GetValueSize

func (t *BitType) GetValueSize() uint64

func (*BitType) Parse

func (t *BitType) Parse(v any) error

type BoolType

type BoolType struct {
	data.BaseValueType
	// contains filtered or unexported fields
}

func (*BoolType) GetTypeKind

func (t *BoolType) GetTypeKind() data.Kind

func (*BoolType) GetTypeName

func (t *BoolType) GetTypeName() string

func (*BoolType) GetTypeSize

func (t *BoolType) GetTypeSize() uint64

func (*BoolType) GetValue

func (t *BoolType) GetValue() any

func (*BoolType) GetValueSize

func (t *BoolType) GetValueSize() uint64

func (*BoolType) Parse

func (t *BoolType) Parse(v any) error

type BytesType

type BytesType struct {
	data.BaseValueType
	// contains filtered or unexported fields
}

func (*BytesType) GetTypeKind

func (t *BytesType) GetTypeKind() data.Kind

func (*BytesType) GetTypeName

func (t *BytesType) GetTypeName() string

func (*BytesType) GetValue

func (t *BytesType) GetValue() any

func (*BytesType) GetValueSize

func (t *BytesType) GetValueSize() uint64

func (*BytesType) Parse

func (t *BytesType) Parse(v any) error

type Cockroach

type Cockroach struct{}

Cockroach is a driver for CockroachDB.

func (*Cockroach) GetDriverName

func (*Cockroach) GetDriverName() string

GetDriverName returns the name of the driver.

func (*Cockroach) IsReadable

func (*Cockroach) IsReadable() bool

func (*Cockroach) IsWritable

func (*Cockroach) IsWritable() bool

func (*Cockroach) Open

func (*Cockroach) Open(ctx context.Context, dsn string) (driver.Connection, error)

Open opens a connection to the database.

type Config

type Config struct {
	Host     string
	Port     int
	Username string
	Password string
	Database string
	Options  url.Values
	Protocol string
}

Config is the configuration for a cockroach database.

func (*Config) String

func (c *Config) String() string

String returns the DSN string.

type Connection

type Connection struct {
	driver.DefaultFilterBuilder
	driver.DefaultSortBuilder
	// contains filtered or unexported fields
}

Connection is a connection to a CockroachDB database.

func (*Connection) Close

func (c *Connection) Close() error

Close closes the connection to the database.

func (*Connection) GetDetails

func (c *Connection) GetDetails(ctx context.Context) (driver.DatabaseDetail, error)

GetDetails returns the details of the database.

func (*Connection) IsClosed

func (c *Connection) IsClosed() bool

IsClosed returns the status of the connection.

func (*Connection) Ping

func (c *Connection) Ping() error

func (*Connection) Write

func (c *Connection) Write(ctx context.Context, table string, dataBatch *data.Batch) error

Write writes a batch of data to the database.

type DateType

type DateType struct {
	data.BaseValueType
	// contains filtered or unexported fields
}

func (*DateType) GetTypeKind

func (t *DateType) GetTypeKind() data.Kind

func (*DateType) GetTypeName

func (t *DateType) GetTypeName() string

func (*DateType) GetValue

func (t *DateType) GetValue() any

func (*DateType) GetValueSize

func (t *DateType) GetValueSize() uint64

func (*DateType) Parse

func (t *DateType) Parse(v any) error

type IntType

type IntType struct {
	data.BaseValueType
	// contains filtered or unexported fields
}

IntType is a type for INT.

func (*IntType) GetTypeKind

func (t *IntType) GetTypeKind() data.Kind

GetTypeKind returns the kind of the type.

func (*IntType) GetTypeName

func (t *IntType) GetTypeName() string

GetTypeName returns the name of the type.

func (*IntType) GetTypeSize

func (t *IntType) GetTypeSize() uint64

GetTypeSize returns the size of the type in bytes.

func (*IntType) GetValue

func (t *IntType) GetValue() any

GetValue returns the value stored in the receiver.

func (*IntType) GetValueSize

func (t *IntType) GetValueSize() uint64

GetValueSize returns the size of the value in bytes.

func (*IntType) Parse

func (t *IntType) Parse(v any) error

Parse parses the value and stores it in the receiver.

type JSONBType

type JSONBType struct {
	data.BaseValueType
	// contains filtered or unexported fields
}

JSONBType is a type for jsonb.

func (*JSONBType) GetTypeKind

func (t *JSONBType) GetTypeKind() data.Kind

GetTypeKind returns the kind of the type.

func (*JSONBType) GetTypeName

func (t *JSONBType) GetTypeName() string

GetTypeName returns the name of the type.

func (*JSONBType) GetValue

func (t *JSONBType) GetValue() any

GetValue returns the value stored in the receiver.

func (*JSONBType) GetValueSize

func (t *JSONBType) GetValueSize() uint64

GetValueSize returns the size of the value in bytes.

func (*JSONBType) Parse

func (t *JSONBType) Parse(v any) error

Parse parses the value and stores it in the receiver.

type StringType

type StringType struct {
	data.BaseValueType
	// contains filtered or unexported fields
}

StringType is a type for string.

func (*StringType) GetTypeKind

func (t *StringType) GetTypeKind() data.Kind

GetTypeKind returns the kind of the type.

func (*StringType) GetTypeName

func (t *StringType) GetTypeName() string

GetTypeName returns the name of the type.

func (*StringType) GetTypeSize

func (t *StringType) GetTypeSize() uint64

GetTypeSize returns the size of the type in bytes.

func (*StringType) GetValue

func (t *StringType) GetValue() any

GetValue returns the value stored in the receiver.

func (*StringType) GetValueSize

func (t *StringType) GetValueSize() uint64

GetValueSize returns the size of the value in bytes.

func (*StringType) Parse

func (t *StringType) Parse(v any) error

Parse parses the value and stores it in the receiver.

type TimestampType

type TimestampType struct {
	data.BaseValueType
	// contains filtered or unexported fields
}

TimestampType is a type for TIMESTAMP.

func (*TimestampType) GetTypeKind

func (t *TimestampType) GetTypeKind() data.Kind

GetTypeKind returns the kind of the type.

func (*TimestampType) GetTypeName

func (t *TimestampType) GetTypeName() string

GetTypeName returns the name of the type.

func (*TimestampType) GetTypeSize

func (t *TimestampType) GetTypeSize() uint64

GetTypeSize returns the size of the type in bytes.

func (*TimestampType) GetValue

func (t *TimestampType) GetValue() any

GetValue returns the value stored in the receiver.

func (*TimestampType) GetValueSize

func (t *TimestampType) GetValueSize() uint64

GetValueSize returns the size of the value in bytes.

func (*TimestampType) Parse

func (t *TimestampType) Parse(v any) error

Parse parses the value and stores it in the receiver.

type UUIDType

type UUIDType struct {
	data.BaseValueType
	// contains filtered or unexported fields
}

UUIDType is a type for UUID.

func (*UUIDType) GetTypeKind

func (t *UUIDType) GetTypeKind() data.Kind

GetTypeKind returns the kind of the type.

func (*UUIDType) GetTypeName

func (t *UUIDType) GetTypeName() string

GetTypeName returns the name of the type.

func (*UUIDType) GetTypeSize

func (t *UUIDType) GetTypeSize() uint64

GetTypeSize returns the size of the type in bytes.

func (*UUIDType) GetValue

func (t *UUIDType) GetValue() any

GetValue returns the value stored in the receiver.

func (*UUIDType) GetValueSize

func (t *UUIDType) GetValueSize() uint64

GetValueSize returns the size of the value in bytes.

func (*UUIDType) Parse

func (t *UUIDType) Parse(v any) error

Parse parses the value and stores it in the receiver.

Jump to

Keyboard shortcuts

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