Documentation ¶
Index ¶
- func ConfigureSnowflakeDB(s *Config) (*sql.DB, error)
- func DSN(conf *Config) (string, error)
- func ExecMulti(ctx context.Context, db *sql.DB, queries []string) error
- func ExecNoRows(ctx context.Context, db *sql.DB, query string) (sql.Result, error)
- func Open(dsn string) (*sql.DB, error)
- func Query(ctx context.Context, db *sql.DB, stmt string) (*sqlx.Rows, error)
- func QueryRow(ctx context.Context, db *sql.DB, stmt string, args ...interface{}) *sqlx.Row
- func RSAKeypairToString(rsaPrivKey *rsa.PrivateKey) (snowflakePrivateKey string, snowflakePublicKey string, err error)
- type Config
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecNoRows ¶
func Query ¶
Query will run stmt against the db and return the rows. We use [DB.Unsafe](https://godoc.org/github.com/jmoiron/sqlx#DB.Unsafe) so that we can scan to structs without worrying about newly introduced columns
func QueryRow ¶
QueryRow will run stmt against the db and return the row. We use [DB.Unsafe](https://godoc.org/github.com/jmoiron/sqlx#DB.Unsafe) so that we can scan to structs without worrying about newly introduced columns
func RSAKeypairToString ¶
func RSAKeypairToString(rsaPrivKey *rsa.PrivateKey) (snowflakePrivateKey string, snowflakePublicKey string, err error)
Formatting based on requirements here: https://docs.snowflake.com/en/user-guide/key-pair-auth.html Important parts:
- pkcs8 format
- 2048 bits
- pem encoding
- no whitespace and headers in private key string
- base64 encoding
Types ¶
type Config ¶
type Config struct { Account string `yaml:"account"` User string `yaml:"username"` Password string `yaml:"password"` BrowserAuth bool `yaml:"browser_auth"` PrivateKeyPath string `yaml:"private_key_path"` PrivateKeyBytes []byte `yaml:"private_key"` OauthAccessToken string `yaml:"oauth_access_token"` Region string `yaml:"region"` Role string `yaml:"role"` Warehouse string `yaml:"warehouse"` }
type User ¶
type User struct { Comment sql.NullString `db:"comment"` DefaultNamespace sql.NullString `db:"default_namespace"` DefaultRole sql.NullString `db:"default_role"` DefaultWarehouse sql.NullString `db:"default_warehouse"` Disabled bool `db:"disabled"` DisplayName sql.NullString `db:"display_name"` Email sql.NullString `db:"email"` FirstName sql.NullString `db:"first_name"` HasRsaPublicKey bool `db:"has_rsa_public_key"` LastName sql.NullString `db:"last_name"` LoginName sql.NullString `db:"login_name"` Name sql.NullString `db:"name"` }
Click to show internal directories.
Click to hide internal directories.