cockroachsql

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Provider

func Provider() *schema.Provider

Provider returns a terraform.ResourceProvider.

func ResourceExistsFunc

func ResourceExistsFunc(fn func(*DBConnection, *schema.ResourceData) (bool, error)) func(*schema.ResourceData, any) (bool, error)

func ResourceFunc

func ResourceFunc(fn func(*DBConnection, *schema.ResourceData) error) func(*schema.ResourceData, any) error

Types

type Client

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

Client struct holding connection string

func (*Client) Connect

func (c *Client) Connect() (*DBConnection, error)

Connect returns a copy to an sql.Open()'ed database connection wrapped in a DBConnection struct. Callers must return their database resources. Use of QueryRow() or Exec() is encouraged. Query() must have their rows.Close()'ed.

type ClientCertificateConfig

type ClientCertificateConfig struct {
	CertificatePath string
	KeyPath         string
	SSLInline       bool
}

type Config

type Config struct {
	ConnectionURL     string
	Host              string
	Port              int
	Username          string
	Password          string
	DatabaseUsername  string
	Superuser         bool
	SSLMode           string
	ApplicationName   string
	Timeout           int
	ConnectTimeoutSec int
	MaxConns          int
	ExpectedVersion   semver.Version
	SSLClientCert     *ClientCertificateConfig
	SSLRootCertPath   string
}

Config - provider config

func (*Config) NewClient

func (c *Config) NewClient(database string) *Client

NewClient returns client config for the specified database.

type DBConnection

type DBConnection struct {
	*sql.DB
	// contains filtered or unexported fields
}

type QueryAble

type QueryAble interface {
	Exec(query string, args ...any) (sql.Result, error)
	Query(query string, args ...any) (*sql.Rows, error)
	QueryRow(query string, args ...any) *sql.Row
}

QueryAble is a DB connection (sql.DB/Tx)

type ResourceSchemeGetter

type ResourceSchemeGetter func(string) any

Jump to

Keyboard shortcuts

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