gosqldriver

package
v0.0.0-...-4a2d37b Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

README

SQL driver for Hera, implementing basic operations as well as basic types (int, string).

Documentation

Overview

Package gosqldriver implements the database/sql/driver interfaces for the the Hera golang driver

Package gosqldriver provides the Hera Go sql driver

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHeraConnection

func NewHeraConnection(conn net.Conn) driver.Conn

NewHeraConnection creates a structure implementing a driver.Con interface

Types

type HeraConn

type HeraConn interface {
	// manualy set the shard ID to which the SQL are executed. it is "sticky", it stays set for all the subsequent
	// SQLs, until ResetShardID() is called. When the shard ID is set, the shard autodiscovery is disabled
	SetShardID(shard int) error
	// resets the shard ID set by SetShardID
	ResetShardID() error
	// returns the number os shards
	GetNumShards() (int, error)

	// This is used for queries which don't have shard key. The format is "<key>=<value1>;<value2>;...<valuen>"
	SetShardKeyPayload(payload string)
	// Reset the state set via SetShardKeyPayload
	ResetShardKeyPayload()

	// Identifier used for logging, specific to a session of SQLs
	SetCalCorrID(corrID string)

	SetClientInfo(poolname string, host string) error

	SetClientInfoWithPoolStack(poolName string, host string, poolStack string) error
}

HeraConn is an API extension for sql.Conn

func InnerConn

func InnerConn(c *sql.Conn) HeraConn

InnerConn returns a HeraConn interface from a *sql.Conn. It uses reflection to walk the internal structure of *sql.Conn to return the inner structure implemented in the driver

type HeraStmt

type HeraStmt interface {
	// A hit to the server for how many rows to return at once
	SetFetchSize(num int)
}

HeraStmt is an API extension for *sql.Stmt

func InnerStmt

func InnerStmt(st *sql.Stmt) HeraStmt

InnerStmt returns a HeraStmt interface from a *sql.Stmt. It uses reflection to walk the internal structure of *sql.Stmt to return the inner structure implemented in the driver

Directories

Path Synopsis
Package tcp provides the Hera driver for Go's database/sql package
Package tcp provides the Hera driver for Go's database/sql package
tls
Package tls provides the Hera driver for Go's database/sql package
Package tls provides the Hera driver for Go's database/sql package

Jump to

Keyboard shortcuts

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