config

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	ExcludedKeyspaces() []string
	SchemaUpdateInterval() time.Duration
	Naming() NamingConventionFn
	UseUserOrRoleAuth() bool
	Logger() log.Logger
	UrlPattern() UrlPattern
}

type ConfigMock

type ConfigMock struct {
	mock.Mock
}

func NewConfigMock

func NewConfigMock() *ConfigMock

func (*ConfigMock) Default

func (o *ConfigMock) Default() *ConfigMock

func (*ConfigMock) ExcludedKeyspaces

func (o *ConfigMock) ExcludedKeyspaces() []string

func (*ConfigMock) Logger

func (o *ConfigMock) Logger() log.Logger

func (*ConfigMock) Naming

func (o *ConfigMock) Naming() NamingConventionFn

func (*ConfigMock) SchemaUpdateInterval

func (o *ConfigMock) SchemaUpdateInterval() time.Duration

func (*ConfigMock) UrlPattern

func (o *ConfigMock) UrlPattern() UrlPattern

func (*ConfigMock) UseUserOrRoleAuth

func (o *ConfigMock) UseUserOrRoleAuth() bool

type KeyspaceNamingInfo

type KeyspaceNamingInfo interface {
	// A map containing the table names as keys and the column names as values
	Tables() map[string][]string
}

type KeyspaceNamingInfoMock

type KeyspaceNamingInfoMock struct {
	mock.Mock
}

func NewKeyspaceNamingInfoMock

func NewKeyspaceNamingInfoMock() *KeyspaceNamingInfoMock

func (*KeyspaceNamingInfoMock) Tables

func (o *KeyspaceNamingInfoMock) Tables() map[string][]string

type NamingConvention

type NamingConvention interface {
	// ToCQLColumn converts a GraphQL/REST name to a CQL column name.
	ToCQLColumn(tableName string, fieldName string) string

	// ToCQLColumn converts a GraphQL/REST name to a CQL table name.
	ToCQLTable(name string) string

	// ToGraphQLField converts a CQL name (typically a column name) to a GraphQL field name.
	ToGraphQLField(tableName string, columnName string) string

	// ToGraphQLOperation converts a CQL name (typically a table name) to a GraphQL operation name.
	ToGraphQLOperation(prefix string, name string) string

	// ToGraphQLType converts a CQL name (typically a table name) to a GraphQL type name.
	ToGraphQLType(name string) string

	// ToGraphQLType converts a CQL table name to a GraphQL while also checking that the type name doesn't collide
	// with types generated by a table name.
	// For example: calls for ToGraphQLTypeUnique("tbl_one", "input") will return
	// - "TblOneInput" when there isn't a table that generates the same name
	// - "TblOneInput2" when there is a table that generates the same name
	ToGraphQLTypeUnique(name string, suffix string) string
}

func NewDefaultNaming

func NewDefaultNaming(info KeyspaceNamingInfo) NamingConvention

type NamingConventionFn

type NamingConventionFn func(KeyspaceNamingInfo) NamingConvention

type SchemaOperations

type SchemaOperations int
const (
	TableCreate SchemaOperations = 1 << iota
	TableDrop
	TableAlterAdd
	TableAlterDrop
	KeyspaceCreate
	KeyspaceDrop
)

func Ops

func Ops(ops ...string) (SchemaOperations, error)

func (*SchemaOperations) Add

func (o *SchemaOperations) Add(ops ...string) error

func (*SchemaOperations) Clear

func (o *SchemaOperations) Clear(ops SchemaOperations)

func (SchemaOperations) IsSupported

func (o SchemaOperations) IsSupported(ops SchemaOperations) bool

func (*SchemaOperations) Set

func (o *SchemaOperations) Set(ops SchemaOperations)

type UrlPattern

type UrlPattern int
const (
	UrlPatternColon UrlPattern = iota
	UrlPatternBrackets
)

Jump to

Keyboard shortcuts

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