client

package
v0.0.1 Latest Latest
Warning

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

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

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