helpers

package
v0.96.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IDDelimiter = "|"
)
View Source
const ResourceIdDelimiter = '|'

Variables

This section is empty.

Functions

func ConcatSlices added in v0.93.0

func ConcatSlices[T any](slices ...[]T) []T

TODO: use slices.Concat in Go 1.22

func ContainsIdentifierIgnoringQuotes added in v0.94.0

func ContainsIdentifierIgnoringQuotes(ids []string, id string) bool

ContainsIdentifierIgnoringQuotes takes ids (a slice of Snowflake identifiers represented as strings), and id (a string representing Snowflake id). It checks if id is contained within ids ignoring quotes around identifier parts.

The original quoting should be retrieved to avoid situations like "object" == "\"object\"" (true) where that should not be a truthful comparison (different ids). Right now, we assume this case won't happen because the quoting difference would only appear in cases where the identifier parts are upper-cased and returned without quotes by snowflake, e.g. "OBJECT" == "\"OBJECT\"" (true) which is correct (the same ids).

func DecodeSnowflakeAccountIdentifier added in v0.93.0

func DecodeSnowflakeAccountIdentifier(identifier string) (sdk.AccountIdentifier, error)

DecodeSnowflakeAccountIdentifier decodes account identifier (usually passed as one of the parameter in tf configuration) into sdk.AccountIdentifier. Check more in https://docs.snowflake.com/en/sql-reference/sql/create-account#required-parameters.

func DecodeSnowflakeID added in v0.64.0

func DecodeSnowflakeID(id string) sdk.ObjectIdentifier

func DecodeSnowflakeParameterID added in v0.75.0

func DecodeSnowflakeParameterID(identifier string) (sdk.ObjectIdentifier, error)

DecodeSnowflakeParameterID decodes identifier (usually passed as one of the parameter in tf configuration) into sdk.ObjectIdentifier. identifier can be specified in two ways: quoted and unquoted, e.g.

quoted { "some_identifier": "\"database.name\".\"schema.name\".\"test.name\" } (note that here dots as part of the name are allowed)

unquoted { "some_identifier": "database_name.schema_name.test_name" } (note that here dots as part of the name are NOT allowed, because they're treated in this case as dividers)

The following configuration { "some_identifier": "db.name" } will be parsed as an object called "name" that lives inside database called "db", not a database called "db.name". In this case quotes should be used.

func EncodeSnowflakeID added in v0.64.0

func EncodeSnowflakeID(attributes ...interface{}) string

EncodeSnowflakeID generates a unique ID for a resource.

func ListContentToString added in v0.36.0

func ListContentToString(listString string) string

ListContentToString strips list elements of double quotes or brackets.

func MergeMaps added in v0.93.0

func MergeMaps[M ~map[K]V, K comparable, V any](src ...M) M

TODO(SNOW-1479870): Test MergeMaps takes any number of maps (of the same type) and concatenates them. In case of key collision, the value will be selected from the map that is provided later in the src function parameter.

func ParseResourceIdentifier added in v0.95.0

func ParseResourceIdentifier(identifier string) []string

func ParseRootLocation added in v0.94.0

func ParseRootLocation(location string) (sdk.SchemaObjectIdentifier, string, error)

TODO(SNOW-1569530): address during identifiers rework follow-up

func RandomBool added in v0.64.0

func RandomBool() bool

func RandomIntRange added in v0.64.0

func RandomIntRange(min, max int) int

func RandomString added in v0.64.0

func RandomString() string

func RandomStringRange added in v0.64.0

func RandomStringRange(min, max int) string

func StringToBool added in v0.62.0

func StringToBool(s string) bool

StringToBool converts a string to a bool.

Types

This section is empty.

Jump to

Keyboard shortcuts

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