Documentation ¶
Overview ¶
Package ioxsql is the compatibility layer from influxdbiox to database/sql.
A database/sql connection can be established through sql.Open. Two data source name formats are supported.
The complete influxdbiox.ClientConfig struct is supported as JSON:
dsn := `{ "address": "localhost:8082", "tls_cert": "...", "tls_key": "..." }` db, err := sql.Open("influxdb-iox", dsn)
The influxdbiox.ClientConfig struct serializes to JSON with method ToJSONString:
config := &influxdbiox.ClientConfig{ Address: "localhost:8082", TLSInsecureSkipVerify: true, } dsn, err = config.ToJSONString() db, err := sql.Open("influxdb-iox", dsn)
The host:port address format is simpler to type, but only sets the address field:
db, err := sql.Open("influxdb-iox", "localhost:8082")
Or a influxdbiox.ClientConfig can be used directly.
config := &influxdbiox.ClientConfig{ Address: "localhost:8082", TLSInsecureSkipVerify: true, } db := sql.OpenDB(ioxsql.NewConnector(config))
Index ¶
- Constants
- type Connection
- func (c *Connection) Begin() (driver.Tx, error)
- func (c *Connection) Client() *influxdbiox.Client
- func (c *Connection) Close() error
- func (c *Connection) IsValid() bool
- func (c *Connection) Ping(ctx context.Context) error
- func (c *Connection) Prepare(query string) (driver.Stmt, error)
- func (c *Connection) PrepareContext(ctx context.Context, query string) (driver.Stmt, error)
- func (c *Connection) ResetSession(ctx context.Context) error
- type Connector
- type Driver
Constants ¶
View Source
const DriverName = "influxdb-iox"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func (*Connection) Client ¶
func (c *Connection) Client() *influxdbiox.Client
Client returns the instance of *influxdbiox.Client backing this Connection. This is useful for sql.Conn.Raw():
conn, err := db.Conn(context.Background()) err = conn.Raw(func(driverConn interface{}) error { // This client object has type *influxdbiox.Client client := driverConn.(*ioxsql.Connection).Client() ... return nil })
func (*Connection) Close ¶
func (c *Connection) Close() error
func (*Connection) IsValid ¶
func (c *Connection) IsValid() bool
func (*Connection) PrepareContext ¶
func (*Connection) ResetSession ¶
func (c *Connection) ResetSession(ctx context.Context) error
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
func NewConnector ¶
func NewConnector(config *influxdbiox.ClientConfig) *Connector
Click to show internal directories.
Click to hide internal directories.