client

package
v0.5.0-rc.10-linux-arm64 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	AuthTypePassword         = "password"
	AuthTypeWorkloadIdentity = "workload_identity"
)

Variables

This section is empty.

Functions

func ValidateCredentials

func ValidateCredentials(credentials Credentials) error

ValidateCredentials enforces the persisted Snowflake authentication shape.

Types

type Client

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

func New

func New(ctx context.Context, config Config, credentials Credentials) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Execute

func (c *Client) Execute(
	ctx context.Context, statement string, args []any, query bool, scanRows RowScanner,
) (Result, error)

func (*Client) ListColumns

func (c *Client) ListColumns(ctx context.Context) ([]Column, error)

func (*Client) TestConnection

func (c *Client) TestConnection(ctx context.Context) error

type Column

type Column struct {
	Schema, Table, Name, DataType, IsNullable string
}

type Config

type Config struct {
	WIFObjects     []snowflakewif.ObjectGrant            `json:"wif_objects,omitempty"`
	Account        string                                `json:"account" validate:"required"`
	Warehouse      string                                `json:"warehouse" validate:"required"`
	Database       string                                `json:"database" validate:"required"`
	Schema         string                                `json:"schema" validate:"required"`
	Role           string                                `json:"role,omitempty"`
	ConnectTimeout int                                   `json:"connect_timeout,omitempty"`
	WIFTokenFile   string                                `json:"_wif_token_file,omitempty"`
	WIFTokenSource func(context.Context) (string, error) `json:"-"`
}

type Credentials

type Credentials struct {
	AuthType string `json:"auth_type" validate:"required"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

type Result

type Result struct {
	Rows        []map[string]any
	ColumnNames []string
	RowCount    int
}

type RowScanner

type RowScanner func(*stdsql.Rows) (Result, error)

RowScanner consumes rows synchronously under the adapter's resource policy.

Jump to

Keyboard shortcuts

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