example

package
v0.77.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilOptions              = errors.New("options cannot be nil")
	ErrInvalidObjectIdentifier = errors.New("invalid object identifier")
)
View Source
var (
	DatabaseRole = g.NewInterface(
		"DatabaseRoles",
		"DatabaseRole",
		"DatabaseObjectIdentifier",
	).
		CreateOperation(
			"https://docs.snowflake.com/en/sql-reference/sql/create-database-role",
			g.NewQueryStruct("CreateDatabaseRole").
				Create().
				OrReplace().
				SQL("DATABASE ROLE").
				IfNotExists().
				Name().
				OptionalTextAssignment("COMMENT", g.ParameterOptions().SingleQuotes()).
				WithValidation(g.ValidIdentifier, "name").
				WithValidation(g.ConflictingFields, "OrReplace", "IfNotExists"),
		).
		AlterOperation(
			"https://docs.snowflake.com/en/sql-reference/sql/alter-database-role",
			g.NewQueryStruct("AlterDatabaseRole").
				Alter().
				SQL("DATABASE ROLE").
				IfExists().
				Name().
				OptionalQueryStructField("Rename", dbRoleRename, g.ListOptions().NoParentheses().SQL("RENAME TO")).
				OptionalQueryStructField("Set", dbRoleSet, g.ListOptions().NoParentheses().SQL("SET")).
				OptionalQueryStructField("Unset", dbRoleUnset, g.ListOptions().NoParentheses().SQL("UNSET")).
				WithValidation(g.ValidIdentifier, "name").
				WithValidation(g.ExactlyOneValueSet, "Rename", "Set", "Unset"),
		)
)

Functions

func ValidObjectIdentifier added in v0.74.0

func ValidObjectIdentifier(objectIdentifier ObjectIdentifier) bool

Types

type AccountObjectIdentifier

type AccountObjectIdentifier struct{}

func RandomAccountObjectIdentifier added in v0.74.0

func RandomAccountObjectIdentifier(t *testing.T) AccountObjectIdentifier

type AlterDatabaseRoleOptions

type AlterDatabaseRoleOptions struct {
	IfExists *bool `ddl:"keyword" sql:"IF EXISTS"`

	Rename *DatabaseRoleRename `ddl:"list,no_parentheses" sql:"RENAME TO"`
	Set    *DatabaseRoleSet    `ddl:"list,no_parentheses" sql:"SET"`
	Unset  *DatabaseRoleUnset  `ddl:"list,no_parentheses" sql:"UNSET"`
	// contains filtered or unexported fields
}

AlterDatabaseRoleOptions is based on https://docs.snowflake.com/en/sql-reference/sql/alter-database-role.

type AlterDatabaseRoleRequest

type AlterDatabaseRoleRequest struct {
	IfExists *bool

	Rename *DatabaseRoleRenameRequest
	Set    *DatabaseRoleSetRequest
	Unset  *DatabaseRoleUnsetRequest
	// contains filtered or unexported fields
}

func NewAlterDatabaseRoleRequest

func NewAlterDatabaseRoleRequest(
	name DatabaseObjectIdentifier,
) *AlterDatabaseRoleRequest

func (*AlterDatabaseRoleRequest) WithIfExists

func (s *AlterDatabaseRoleRequest) WithIfExists(IfExists *bool) *AlterDatabaseRoleRequest

func (*AlterDatabaseRoleRequest) WithRename

func (*AlterDatabaseRoleRequest) WithSet

func (*AlterDatabaseRoleRequest) WithUnset

type Client

type Client struct{}

type CreateDatabaseRoleOptions

type CreateDatabaseRoleOptions struct {
	OrReplace *bool `ddl:"keyword" sql:"OR REPLACE"`

	IfNotExists *bool `ddl:"keyword" sql:"IF NOT EXISTS"`

	Comment *string `ddl:"parameter,single_quotes" sql:"COMMENT"`
	// contains filtered or unexported fields
}

CreateDatabaseRoleOptions is based on https://docs.snowflake.com/en/sql-reference/sql/create-database-role.

type CreateDatabaseRoleRequest

type CreateDatabaseRoleRequest struct {
	OrReplace   *bool
	IfNotExists *bool

	Comment *string
	// contains filtered or unexported fields
}

func NewCreateDatabaseRoleRequest

func NewCreateDatabaseRoleRequest(
	name DatabaseObjectIdentifier,
) *CreateDatabaseRoleRequest

func (*CreateDatabaseRoleRequest) WithComment

func (*CreateDatabaseRoleRequest) WithIfNotExists

func (s *CreateDatabaseRoleRequest) WithIfNotExists(IfNotExists *bool) *CreateDatabaseRoleRequest

func (*CreateDatabaseRoleRequest) WithOrReplace

func (s *CreateDatabaseRoleRequest) WithOrReplace(OrReplace *bool) *CreateDatabaseRoleRequest

type DatabaseObjectIdentifier

type DatabaseObjectIdentifier struct{}

func RandomDatabaseObjectIdentifier added in v0.74.0

func RandomDatabaseObjectIdentifier(t *testing.T) DatabaseObjectIdentifier

type DatabaseRoleRename

type DatabaseRoleRename struct {
	Name DatabaseObjectIdentifier `ddl:"identifier"`
}

type DatabaseRoleRenameRequest

type DatabaseRoleRenameRequest struct {
	Name DatabaseObjectIdentifier // required
}

func NewDatabaseRoleRenameRequest

func NewDatabaseRoleRenameRequest(
	Name DatabaseObjectIdentifier,
) *DatabaseRoleRenameRequest

type DatabaseRoleSet

type DatabaseRoleSet struct {
	Comment          string            `ddl:"parameter,single_quotes" sql:"COMMENT"`
	NestedThirdLevel *NestedThirdLevel `ddl:"list,no_parentheses" sql:"NESTED"`
}

type DatabaseRoleSetRequest

type DatabaseRoleSetRequest struct {
	Comment          string // required
	NestedThirdLevel *NestedThirdLevelRequest
}

func NewDatabaseRoleSetRequest

func NewDatabaseRoleSetRequest(
	Comment string,
) *DatabaseRoleSetRequest

func (*DatabaseRoleSetRequest) WithNestedThirdLevel

func (s *DatabaseRoleSetRequest) WithNestedThirdLevel(NestedThirdLevel *NestedThirdLevelRequest) *DatabaseRoleSetRequest

type DatabaseRoleUnset

type DatabaseRoleUnset struct {
	Comment *bool `ddl:"keyword" sql:"COMMENT"`
}

type DatabaseRoleUnsetRequest

type DatabaseRoleUnsetRequest struct {
	Comment *bool
}

func NewDatabaseRoleUnsetRequest

func NewDatabaseRoleUnsetRequest() *DatabaseRoleUnsetRequest

func (*DatabaseRoleUnsetRequest) WithComment added in v0.72.0

func (s *DatabaseRoleUnsetRequest) WithComment(Comment *bool) *DatabaseRoleUnsetRequest

type DatabaseRoles

type DatabaseRoles interface {
	Create(ctx context.Context, request *CreateDatabaseRoleRequest) error
	Alter(ctx context.Context, request *AlterDatabaseRoleRequest) error
}

type ExternalObjectIdentifier

type ExternalObjectIdentifier struct{}

type NestedThirdLevel

type NestedThirdLevel struct {
	Field DatabaseObjectIdentifier `ddl:"identifier"`
}

type NestedThirdLevelRequest

type NestedThirdLevelRequest struct {
	Field DatabaseObjectIdentifier // required
}

func NewNestedThirdLevelRequest

func NewNestedThirdLevelRequest(
	Field DatabaseObjectIdentifier,
) *NestedThirdLevelRequest

type ObjectIdentifier

type ObjectIdentifier interface{}

type SchemaObjectIdentifier

type SchemaObjectIdentifier struct{}

func RandomSchemaObjectIdentifier added in v0.74.0

func RandomSchemaObjectIdentifier(t *testing.T) SchemaObjectIdentifier

type TableColumnIdentifier

type TableColumnIdentifier struct{}

Jump to

Keyboard shortcuts

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