sqlstorev2

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const PluginName = "sql_v2"

PluginName is the catalog name of the GORM v2 SQL datastore.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

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

Plugin is a SQL datastore backed by GORM v2. It holds a read-write connection and, when ro_connection_string is set, a read-only one.

func New

func New(log logrus.FieldLogger) *Plugin

New returns an unconfigured Plugin. Configure must be called before use.

func (*Plugin) Close

func (ds *Plugin) Close() error

Close closes the read-write and read-only connections if open. It is safe to call multiple times.

func (*Plugin) Configure

func (ds *Plugin) Configure(ctx context.Context, hclConfiguration string) error

Configure parses the HCL config, validates it, and opens the connection(s).

func (*Plugin) RawScan

func (ds *Plugin) RawScan(dest any, query string) error

RawScan runs a raw query on the read-write connection and scans the result into dest. It holds ds.mu for the whole query so a concurrent Configure or Close cannot swap or close the connection mid-scan. It is intended for tests, so blocking a reconfigure for the duration is acceptable.

Jump to

Keyboard shortcuts

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