Documentation
¶
Index ¶
- Constants
- Variables
- func Bool(b bool) *bool
- func DefaultConfig() *gosnowflake.Config
- func EnvConfig() *gosnowflake.Config
- func Int(i int) *int
- func IsValidDataType(v string) bool
- func MergeConfig(baseConfig *gosnowflake.Config, mergeConfig *gosnowflake.Config) *gosnowflake.Config
- func ProfileConfig(profile string) (*gosnowflake.Config, error)
- func String(s string) *string
- type AccountObjectIdentifier
- type Client
- type ContextFunctions
- type DataType
- type Database
- type DatabaseCreateOptions
- type In
- type IntProperty
- type Like
- type MaskingPolicies
- type MaskingPolicy
- type MaskingPolicyAlterOptions
- type MaskingPolicyCreateOptions
- type MaskingPolicyDetails
- type MaskingPolicyDropOptions
- type MaskingPolicySet
- type MaskingPolicyShowOptions
- type MaskingPolicyUnset
- type ObjectIdentifier
- type ObjectType
- type PasswordPolicies
- type PasswordPolicy
- type PasswordPolicyAlterOptions
- type PasswordPolicyCreateOptions
- type PasswordPolicyDetails
- type PasswordPolicyDropOptions
- type PasswordPolicySet
- type PasswordPolicyShowOptions
- type PasswordPolicyUnset
- type Schema
- type SchemaIdentifier
- type SchemaObjectIdentifier
- type Sessions
- type StringProperty
- type SystemFunctions
- type TableColumnIdentifier
- type TableColumnSignature
- type Tag
- type TagAssociation
- type TagCreateOptions
- type Warehouse
- type WarehouseAlterOptions
- type WarehouseCreateOptions
- type WarehouseDetails
- type WarehouseDropOptions
- type WarehouseShowOptions
- type Warehouses
Constants ¶
const ( NoQuotes quoteType = "no_quotes" DoubleQuotes quoteType = "double_quotes" SingleQuotes quoteType = "single_quotes" )
Variables ¶
var ( // go-snowflake errors. ErrObjectNotExistOrAuthorized = errors.New("object does not exist or not authorized") ErrAccountIsEmpty = errors.New("account is empty") )
Functions ¶
func DefaultConfig ¶
func DefaultConfig() *gosnowflake.Config
func EnvConfig ¶
func EnvConfig() *gosnowflake.Config
func IsValidDataType ¶
func MergeConfig ¶
func MergeConfig(baseConfig *gosnowflake.Config, mergeConfig *gosnowflake.Config) *gosnowflake.Config
func ProfileConfig ¶
func ProfileConfig(profile string) (*gosnowflake.Config, error)
Types ¶
type AccountObjectIdentifier ¶
type AccountObjectIdentifier struct {
// contains filtered or unexported fields
}
func NewAccountObjectIdentifier ¶
func NewAccountObjectIdentifier(name string) AccountObjectIdentifier
func (AccountObjectIdentifier) FullyQualifiedName ¶
func (i AccountObjectIdentifier) FullyQualifiedName() string
func (AccountObjectIdentifier) Name ¶
func (i AccountObjectIdentifier) Name() string
type Client ¶
type Client struct {
ContextFunctions ContextFunctions
MaskingPolicies MaskingPolicies
PasswordPolicies PasswordPolicies
Sessions Sessions
SystemFunctions SystemFunctions
Warehouses Warehouses
// contains filtered or unexported fields
}
func NewClientFromDB ¶
func NewDefaultClient ¶
type ContextFunctions ¶
type DataType ¶
type DataType string
const ( DataTypeNumber DataType = "NUMBER" DataTypeFloat DataType = "FLOAT" DataTypeVARCHAR DataType = "VARCHAR" DataTypeBinary DataType = "BINARY" DataTypeBoolean DataType = "BOOLEAN" DataTypeDate DataType = "DATE" DataTypeTime DataType = "TIME" DataTypeTimestampLTZ DataType = "TIMESTAMP_LTZ" DataTypeTimestampNTZ DataType = "TIMESTAMP_NTZ" DataTypeTimestampTZ DataType = "TIMESTAMP_TZ" DataTypeVariant DataType = "VARIANT" DataTypeObject DataType = "OBJECT" DataTypeArray DataType = "ARRAY" DataTypeGeography DataType = "GEOGRAPHY" DataTypeGeometry DataType = "GEOMETRY" // DataTypeUnknown is used for testing purposes only. DataTypeUnknown DataType = "UNKNOWN" )
func DataTypeFromString ¶
type Database ¶
type Database struct {
Name string
}
func (*Database) ID ¶
func (v *Database) ID() AccountObjectIdentifier
type DatabaseCreateOptions ¶
type DatabaseCreateOptions struct{}
placeholder for the real implementation.
type In ¶
type In struct {
Account *bool `ddl:"keyword" db:"ACCOUNT"`
Database AccountObjectIdentifier `ddl:"identifier" db:"DATABASE"`
Schema SchemaIdentifier `ddl:"identifier" db:"SCHEMA"`
}
type IntProperty ¶
type MaskingPolicies ¶
type MaskingPolicies interface {
// Create creates a new masking policy.
Create(ctx context.Context, id SchemaObjectIdentifier, signature []TableColumnSignature, returns DataType, expression string, opts *MaskingPolicyCreateOptions) error
// Alter modifies an existing masking policy.
Alter(ctx context.Context, id SchemaObjectIdentifier, opts *MaskingPolicyAlterOptions) error
// Drop removes a masking policy.
Drop(ctx context.Context, id SchemaObjectIdentifier) error
// Show returns a list of masking policies.
Show(ctx context.Context, opts *MaskingPolicyShowOptions) ([]*MaskingPolicy, error)
// Describe returns the details of a masking policy.
Describe(ctx context.Context, id SchemaObjectIdentifier) (*MaskingPolicyDetails, error)
}
MaskingPolicies describes all the masking policy related methods that the Snowflake API supports.
type MaskingPolicy ¶
type MaskingPolicy struct {
CreatedOn time.Time
Name string
DatabaseName string
SchemaName string
Kind string
Owner string
Comment string
ExemptOtherPolicies bool
}
MaskingPolicys is a user friendly result for a CREATE MASKING POLICY query.
func (*MaskingPolicy) ID ¶
func (v *MaskingPolicy) ID() SchemaObjectIdentifier
type MaskingPolicyAlterOptions ¶
type MaskingPolicyAlterOptions struct {
IfExists *bool `ddl:"keyword" db:"IF EXISTS"`
NewName SchemaObjectIdentifier `ddl:"identifier" db:"RENAME TO"`
Set *MaskingPolicySet `ddl:"keyword" db:"SET"`
Unset *MaskingPolicyUnset `ddl:"keyword" db:"UNSET"`
// contains filtered or unexported fields
}
type MaskingPolicyCreateOptions ¶
type MaskingPolicyCreateOptions struct {
OrReplace *bool `ddl:"keyword" db:"OR REPLACE"`
IfNotExists *bool `ddl:"keyword" db:"IF NOT EXISTS"`
// optional
Comment *string `ddl:"parameter,single_quotes" db:"COMMENT"`
ExemptOtherPolicies *bool `ddl:"parameter" db:"EXEMPT_OTHER_POLICIES"`
// contains filtered or unexported fields
}
type MaskingPolicyDetails ¶
type MaskingPolicyDetails struct {
Name string
Signature []TableColumnSignature
ReturnType DataType
Body string
}
type MaskingPolicyDropOptions ¶
type MaskingPolicyDropOptions struct {
// contains filtered or unexported fields
}
type MaskingPolicySet ¶
type MaskingPolicySet struct {
Body *string `ddl:"command" db:"BODY ->"`
Tag []TagAssociation `ddl:"list,no_parentheses" db:"TAG"`
Comment *string `ddl:"parameter,single_quotes" db:"COMMENT"`
}
type MaskingPolicyShowOptions ¶
type MaskingPolicyShowOptions struct {
Like *Like `ddl:"keyword" db:"LIKE"`
In *In `ddl:"keyword" db:"IN"`
Limit *int `ddl:"command,no_quotes" db:"LIMIT"`
// contains filtered or unexported fields
}
MaskingPolicyShowOptions represents the options for listing masking policies.
type MaskingPolicyUnset ¶
type MaskingPolicyUnset struct {
Tag []ObjectIdentifier `ddl:"list,no_parentheses" db:"TAG"`
Comment *bool `ddl:"keyword" db:"COMMENT"`
}
type ObjectIdentifier ¶
type ObjectType ¶
type ObjectType string
ObjectType is the type of object.
const ( ObjectTypeMaskingPolicy ObjectType = "MASKING POLICY" ObjectTypePasswordPolicy ObjectType = "PASSWORD POLICY" )
func (ObjectType) String ¶
func (o ObjectType) String() string
type PasswordPolicies ¶
type PasswordPolicies interface {
// Create creates a new password policy.
Create(ctx context.Context, id SchemaObjectIdentifier, opts *PasswordPolicyCreateOptions) error
// Alter modifies an existing password policy.
Alter(ctx context.Context, id SchemaObjectIdentifier, opts *PasswordPolicyAlterOptions) error
// Drop removes a password policy.
Drop(ctx context.Context, id SchemaObjectIdentifier, opts *PasswordPolicyDropOptions) error
// Show returns a list of password policies.
Show(ctx context.Context, opts *PasswordPolicyShowOptions) ([]*PasswordPolicy, error)
// Describe returns the details of a password policy.
Describe(ctx context.Context, id SchemaObjectIdentifier) (*PasswordPolicyDetails, error)
}
PasswordPolicies describes all the password policy related methods that the Snowflake API supports.
type PasswordPolicy ¶
type PasswordPolicy struct {
CreatedOn time.Time
Name string
DatabaseName string
SchemaName string
Kind string
Owner string
Comment string
}
PasswordPolicys is a user friendly result for a CREATE PASSWORD POLICY query.
func (*PasswordPolicy) ID ¶
func (v *PasswordPolicy) ID() SchemaObjectIdentifier
type PasswordPolicyAlterOptions ¶
type PasswordPolicyAlterOptions struct {
IfExists *bool `ddl:"keyword" db:"IF EXISTS"`
NewName SchemaObjectIdentifier `ddl:"identifier" db:"RENAME TO"`
Set *PasswordPolicySet `ddl:"keyword" db:"SET"`
Unset *PasswordPolicyUnset `ddl:"keyword" db:"UNSET"`
// contains filtered or unexported fields
}
type PasswordPolicyCreateOptions ¶
type PasswordPolicyCreateOptions struct {
OrReplace *bool `ddl:"keyword" db:"OR REPLACE"`
IfNotExists *bool `ddl:"keyword" db:"IF NOT EXISTS"`
PasswordMinLength *int `ddl:"parameter" db:"PASSWORD_MIN_LENGTH"`
PasswordMaxLength *int `ddl:"parameter" db:"PASSWORD_MAX_LENGTH"`
PasswordMinUpperCaseChars *int `ddl:"parameter" db:"PASSWORD_MIN_UPPER_CASE_CHARS"`
PasswordMinLowerCaseChars *int `ddl:"parameter" db:"PASSWORD_MIN_LOWER_CASE_CHARS"`
PasswordMinNumericChars *int `ddl:"parameter" db:"PASSWORD_MIN_NUMERIC_CHARS"`
PasswordMinSpecialChars *int `ddl:"parameter" db:"PASSWORD_MIN_SPECIAL_CHARS"`
PasswordMaxAgeDays *int `ddl:"parameter" db:"PASSWORD_MAX_AGE_DAYS"`
PasswordMaxRetries *int `ddl:"parameter" db:"PASSWORD_MAX_RETRIES"`
PasswordLockoutTimeMins *int `ddl:"parameter" db:"PASSWORD_LOCKOUT_TIME_MINS"`
Comment *string `ddl:"parameter,single_quotes" db:"COMMENT"`
// contains filtered or unexported fields
}
type PasswordPolicyDetails ¶
type PasswordPolicyDetails struct {
Name *StringProperty
Owner *StringProperty
Comment *StringProperty
PasswordMinLength *IntProperty
PasswordMaxLength *IntProperty
PasswordMinUpperCaseChars *IntProperty
PasswordMinLowerCaseChars *IntProperty
PasswordMinNumericChars *IntProperty
PasswordMinSpecialChars *IntProperty
PasswordMaxAgeDays *IntProperty
PasswordMaxRetries *IntProperty
PasswordLockoutTimeMins *IntProperty
}
type PasswordPolicyDropOptions ¶
type PasswordPolicyDropOptions struct {
IfExists *bool `ddl:"keyword" db:"IF EXISTS"`
// contains filtered or unexported fields
}
type PasswordPolicySet ¶
type PasswordPolicySet struct {
PasswordMinLength *int `ddl:"parameter" db:"PASSWORD_MIN_LENGTH"`
PasswordMaxLength *int `ddl:"parameter" db:"PASSWORD_MAX_LENGTH"`
PasswordMinUpperCaseChars *int `ddl:"parameter" db:"PASSWORD_MIN_UPPER_CASE_CHARS"`
PasswordMinLowerCaseChars *int `ddl:"parameter" db:"PASSWORD_MIN_LOWER_CASE_CHARS"`
PasswordMinNumericChars *int `ddl:"parameter" db:"PASSWORD_MIN_NUMERIC_CHARS"`
PasswordMinSpecialChars *int `ddl:"parameter" db:"PASSWORD_MIN_SPECIAL_CHARS"`
PasswordMaxAgeDays *int `ddl:"parameter" db:"PASSWORD_MAX_AGE_DAYS"`
PasswordMaxRetries *int `ddl:"parameter" db:"PASSWORD_MAX_RETRIES"`
PasswordLockoutTimeMins *int `ddl:"parameter" db:"PASSWORD_LOCKOUT_TIME_MINS"`
Comment *string `ddl:"parameter,single_quotes" db:"COMMENT"`
}
type PasswordPolicyShowOptions ¶
type PasswordPolicyShowOptions struct {
Like *Like `ddl:"keyword" db:"LIKE"`
In *In `ddl:"keyword" db:"IN"`
Limit *int `ddl:"command,no_quotes" db:"LIMIT"`
// contains filtered or unexported fields
}
PasswordPolicyShowOptions represents the options for listing password policies.
type PasswordPolicyUnset ¶
type PasswordPolicyUnset struct {
PasswordMinLength *bool `ddl:"keyword" db:"PASSWORD_MIN_LENGTH"`
PasswordMaxLength *bool `ddl:"keyword" db:"PASSWORD_MAX_LENGTH"`
PasswordMinUpperCaseChars *bool `ddl:"keyword" db:"PASSWORD_MIN_UPPER_CASE_CHARS"`
PasswordMinLowerCaseChars *bool `ddl:"keyword" db:"PASSWORD_MIN_LOWER_CASE_CHARS"`
PasswordMinNumericChars *bool `ddl:"keyword" db:"PASSWORD_MIN_NUMERIC_CHARS"`
PasswordMinSpecialChars *bool `ddl:"keyword" db:"PASSWORD_MIN_SPECIAL_CHARS"`
PasswordMaxAgeDays *bool `ddl:"keyword" db:"PASSWORD_MAX_AGE_DAYS"`
PasswordMaxRetries *bool `ddl:"keyword" db:"PASSWORD_MAX_RETRIES"`
PasswordLockoutTimeMins *bool `ddl:"keyword" db:"PASSWORD_LOCKOUT_TIME_MINS"`
Comment *bool `ddl:"keyword" db:"COMMENT"`
}
type Schema ¶
placeholder for the real implementation.
func (*Schema) ID ¶
func (v *Schema) ID() SchemaIdentifier
type SchemaIdentifier ¶
type SchemaIdentifier struct {
// contains filtered or unexported fields
}
func NewSchemaIdentifier ¶
func NewSchemaIdentifier(databaseName, schemaName string) SchemaIdentifier
func NewSchemaIdentifierFromFullyQualifiedName ¶
func NewSchemaIdentifierFromFullyQualifiedName(fullyQualifiedName string) SchemaIdentifier
func (SchemaIdentifier) DatabaseName ¶
func (i SchemaIdentifier) DatabaseName() string
func (SchemaIdentifier) FullyQualifiedName ¶
func (i SchemaIdentifier) FullyQualifiedName() string
func (SchemaIdentifier) Name ¶
func (i SchemaIdentifier) Name() string
type SchemaObjectIdentifier ¶
type SchemaObjectIdentifier struct {
// contains filtered or unexported fields
}
func NewSchemaObjectIdentifier ¶
func NewSchemaObjectIdentifier(databaseName, schemaName, name string) SchemaObjectIdentifier
func NewSchemaObjectIdentifierFromFullyQualifiedName ¶
func NewSchemaObjectIdentifierFromFullyQualifiedName(fullyQualifiedName string) SchemaObjectIdentifier
func (SchemaObjectIdentifier) DatabaseName ¶
func (i SchemaObjectIdentifier) DatabaseName() string
func (SchemaObjectIdentifier) FullyQualifiedName ¶
func (i SchemaObjectIdentifier) FullyQualifiedName() string
func (SchemaObjectIdentifier) Name ¶
func (i SchemaObjectIdentifier) Name() string
func (SchemaObjectIdentifier) SchemaName ¶
func (i SchemaObjectIdentifier) SchemaName() string
type Sessions ¶
type Sessions interface {
// Context functions.
UseWarehouse(ctx context.Context, warehouse AccountObjectIdentifier) error
UseDatabase(ctx context.Context, database AccountObjectIdentifier) error
UseSchema(ctx context.Context, schema SchemaIdentifier) error
}
type StringProperty ¶
type SystemFunctions ¶
type SystemFunctions interface {
GetTag(ctx context.Context, tagID ObjectIdentifier, objectID ObjectIdentifier, typ ObjectType) (string, error)
}
type TableColumnIdentifier ¶
type TableColumnIdentifier struct {
// contains filtered or unexported fields
}
func NewTableColumnIdentifier ¶
func NewTableColumnIdentifier(databaseName, schemaName, tableName, columnName string) TableColumnIdentifier
func NewTableColumnIdentifierFromFullyQualifiedName ¶
func NewTableColumnIdentifierFromFullyQualifiedName(fullyQualifiedName string) TableColumnIdentifier
func (TableColumnIdentifier) DatabaseName ¶
func (i TableColumnIdentifier) DatabaseName() string
func (TableColumnIdentifier) FullyQualifiedName ¶
func (i TableColumnIdentifier) FullyQualifiedName() string
func (TableColumnIdentifier) Name ¶
func (i TableColumnIdentifier) Name() string
func (TableColumnIdentifier) SchemaName ¶
func (i TableColumnIdentifier) SchemaName() string
func (TableColumnIdentifier) TableName ¶
func (i TableColumnIdentifier) TableName() string
type TableColumnSignature ¶
type TagAssociation ¶
type TagAssociation struct {
Name ObjectIdentifier `ddl:"identifier"`
Value string `ddl:"keyword,single_quotes"`
// contains filtered or unexported fields
}
type Warehouse ¶
type Warehouse struct {
Name string
}
func (*Warehouse) ID ¶
func (v *Warehouse) ID() AccountObjectIdentifier
type WarehouseAlterOptions ¶
type WarehouseAlterOptions struct{}
placeholder for the real implementation.
type WarehouseCreateOptions ¶
type WarehouseCreateOptions struct{}
placeholder for the real implementation.
type WarehouseDetails ¶
type WarehouseDetails struct {
Name string
}
type WarehouseDropOptions ¶
type WarehouseDropOptions struct{}
placeholder for the real implementation.
type WarehouseShowOptions ¶
type WarehouseShowOptions struct{}
placeholder for the real implementation.
type Warehouses ¶
type Warehouses interface {
// Create creates a warehouse.
Create(ctx context.Context, id AccountObjectIdentifier, opts *WarehouseCreateOptions) error
// Alter modifies an existing warehouse
Alter(ctx context.Context, id AccountObjectIdentifier, opts *WarehouseAlterOptions) error
// Drop removes a warehouse.
Drop(ctx context.Context, id AccountObjectIdentifier, opts *WarehouseDropOptions) error
// Show returns a list of warehouses.
Show(ctx context.Context, opts *WarehouseShowOptions) ([]*Warehouse, error)
// Describe returns the details of a warehouse.
Describe(ctx context.Context, id AccountObjectIdentifier) (*WarehouseDetails, error)
}