example

package
v0.71.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DatabaseRole = g.NewInterface("DatabaseRoles", "DatabaseRole", "DatabaseObjectIdentifier").WithOperations(
	[]*g.Operation{
		g.NewOperation("Create", "https://docs.snowflake.com/en/sql-reference/sql/create-database-role").WithOptsField(
			g.NewField("<should be updated programmatically>", "<should be updated programmatically>", nil).
				WithFields([]*g.Field{
					g.NewField("create", "bool", map[string][]string{"ddl": {"static"}, "sql": {"CREATE"}}),
					g.NewField("OrReplace", "*bool", map[string][]string{"ddl": {"keyword"}, "sql": {"OR REPLACE"}}),
					g.NewField("databaseRole", "bool", map[string][]string{"ddl": {"static"}, "sql": {"DATABASE ROLE"}}),
					g.NewField("IfNotExists", "*bool", map[string][]string{"ddl": {"keyword"}, "sql": {"IF NOT EXISTS"}}),
					g.NewField("name", "DatabaseObjectIdentifier", map[string][]string{"ddl": {"identifier"}}).WithRequired(true),
					g.NewField("Comment", "*string", map[string][]string{"ddl": {"parameter", "single_quotes"}, "sql": {"COMMENT"}}),
				}).
				WithValidations([]*g.Validation{
					g.NewValidation(g.ValidIdentifier, []string{"name"}),
					g.NewValidation(g.ConflictingFields, []string{"OrReplace", "IfNotExists"}),
				}),
		),
		g.NewOperation("Alter", "https://docs.snowflake.com/en/sql-reference/sql/alter-database-role").WithOptsField(
			g.NewField("<should be updated programmatically>", "<should be updated programmatically>", nil).
				WithFields([]*g.Field{
					g.NewField("alter", "bool", map[string][]string{"ddl": {"static"}, "sql": {"ALTER"}}),
					g.NewField("databaseRole", "bool", map[string][]string{"ddl": {"static"}, "sql": {"DATABASE ROLE"}}),
					g.NewField("IfExists", "*bool", map[string][]string{"ddl": {"keyword"}, "sql": {"IF EXISTS"}}),
					g.NewField("name", "DatabaseObjectIdentifier", map[string][]string{"ddl": {"identifier"}}).WithRequired(true),
					g.NewField("Rename", "*DatabaseRoleRename", map[string][]string{"ddl": {"list,no_parentheses"}, "sql": {"RENAME TO"}}).
						WithFields([]*g.Field{
							g.NewField("Name", "DatabaseObjectIdentifier", map[string][]string{"ddl": {"identifier"}}).WithRequired(true),
						}).
						WithValidations([]*g.Validation{
							g.NewValidation(g.ValidIdentifier, []string{"Name"}),
						}),
					g.NewField("Set", "*DatabaseRoleSet", map[string][]string{"ddl": {"list,no_parentheses"}, "sql": {"SET"}}).
						WithFields([]*g.Field{
							g.NewField("Comment", "string", map[string][]string{"ddl": {"parameter", "single_quotes"}, "sql": {"COMMENT"}}).WithRequired(true),
							g.NewField("NestedThirdLevel", "*NestedThirdLevel", map[string][]string{"ddl": {"list,no_parentheses"}, "sql": {"NESTED"}}).
								WithFields([]*g.Field{
									g.NewField("Field", "DatabaseObjectIdentifier", map[string][]string{"ddl": {"identifier"}}).WithRequired(true),
								}).
								WithValidations([]*g.Validation{
									g.NewValidation(g.AtLeastOneValueSet, []string{"Field"}),
								}),
						}),
					g.NewField("Unset", "*DatabaseRoleUnset", map[string][]string{"ddl": {"list,no_parentheses"}, "sql": {"UNSET"}}).
						WithFields([]*g.Field{
							g.NewField("Comment", "bool", map[string][]string{"ddl": {"keyword"}, "sql": {"COMMENT"}}).WithRequired(true),
						}).
						WithValidations([]*g.Validation{
							g.NewValidation(g.AtLeastOneValueSet, []string{"Comment"}),
						}),
				}).
				WithValidations([]*g.Validation{
					g.NewValidation(g.ValidIdentifier, []string{"name"}),
					g.NewValidation(g.ExactlyOneValueSet, []string{"Rename", "Set", "Unset"}),
				}),
		),
	},
)
View Source
var (
	ErrInvalidObjectIdentifier = errors.New("invalid object identifier")
)

Functions

This section is empty.

Types

type AccountObjectIdentifier

type AccountObjectIdentifier struct{}

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{}

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 // required
}

func NewDatabaseRoleUnsetRequest

func NewDatabaseRoleUnsetRequest(
	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{}

type TableColumnIdentifier

type TableColumnIdentifier struct{}

Jump to

Keyboard shortcuts

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