sqlname

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright (c) YugabyteDB, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) YugabyteDB, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	YUGABYTEDB = "yugabytedb"
	POSTGRESQL = "postgresql"
	ORACLE     = "oracle"
	MYSQL      = "mysql"
)

Variables

View Source
var (
	SourceDBType string
	PreserveCase bool
)
View Source
var OracleReservedKeywords = []string{}/* 253 elements not displayed */
View Source
var PgReservedKeywords = []string{"all", "analyse", "analyze", "and", "any", "array",
	"as", "asc", "asymmetric", "both", "case", "cast", "check", "collate", "column",
	"constraint", "create", "current_catalog", "current_date", "current_role",
	"current_time", "current_timestamp", "current_user", "default", "deferrable",
	"desc", "distinct", "do", "else", "end", "except", "false", "fetch", "for", "foreign",
	"from", "grant", "group", "having", "in", "initially", "intersect", "into", "lateral",
	"leading", "limit", "localtime", "localtimestamp", "not", "null", "offset", "on",
	"only", "or", "order", "placing", "primary", "references", "returning", "select",
	"session_user", "some", "symmetric", "table", "then", "to", "trailing", "true",
	"union", "unique", "user", "using", "variadic", "when", "where", "window", "with"}

Functions

func IsAllLowercase added in v1.3.0

func IsAllLowercase(s string) bool

func IsAllUppercase added in v1.3.0

func IsAllUppercase(s string) bool

func IsCaseSensitive added in v1.3.0

func IsCaseSensitive(s string, sourceDbType string) bool

func IsQuoted added in v1.4.0

func IsQuoted(s string) bool

func IsReservedKeywordOracle added in v1.5.0

func IsReservedKeywordOracle(word string) bool

func IsReservedKeywordPG added in v1.5.0

func IsReservedKeywordPG(word string) bool

Types

type Identifier

type Identifier struct {
	Quoted    string
	Unquoted  string
	MinQuoted string
}

type NameTuple added in v1.7.0

type NameTuple struct {
	// Mode        string
	CurrentName *ObjectName
	SourceName  *ObjectName
	TargetName  *ObjectName
}

<SourceTableName, TargetTableName>

func SetDifferenceNameTuples added in v1.7.0

func SetDifferenceNameTuples(a, b []NameTuple) []NameTuple

func (NameTuple) AsQualifiedCatalogName added in v1.7.0

func (t NameTuple) AsQualifiedCatalogName() string

func (NameTuple) Equals added in v1.7.0

func (t1 NameTuple) Equals(t2 NameTuple) bool

func (NameTuple) ForCatalogQuery added in v1.7.0

func (t NameTuple) ForCatalogQuery() (string, string)

func (NameTuple) ForKey added in v1.7.0

func (t NameTuple) ForKey() string

func (NameTuple) ForMinOutput added in v1.7.0

func (t NameTuple) ForMinOutput() string

func (NameTuple) ForOutput added in v1.7.0

func (t NameTuple) ForOutput() string

func (NameTuple) ForUserQuery added in v1.7.0

func (t NameTuple) ForUserQuery() string

func (NameTuple) Key added in v1.7.0

func (t NameTuple) Key() string

Implements: utils.Keyer.Key()

func (NameTuple) MatchesPattern added in v1.7.0

func (t NameTuple) MatchesPattern(pattern string) (bool, error)

func (NameTuple) String added in v1.7.0

func (t NameTuple) String() string

type ObjectName added in v1.7.0

type ObjectName struct {
	SchemaName        string
	FromDefaultSchema bool

	Qualified    identifier
	Unqualified  identifier
	MinQualified identifier
}

Can be a name of a table, sequence, materialised view, etc.

func NewObjectName added in v1.7.0

func NewObjectName(dbType, defaultSchemaName, schemaName, tableName string) *ObjectName

func (*ObjectName) MatchesPattern added in v1.7.0

func (nv *ObjectName) MatchesPattern(pattern string) (bool, error)

func (*ObjectName) String added in v1.7.0

func (nv *ObjectName) String() string

type SourceName

type SourceName struct {
	ObjectName Identifier
	SchemaName Identifier
	Qualified  Identifier
}

func NewSourceName

func NewSourceName(schemaName, objectName string) *SourceName

func NewSourceNameFromMaybeQualifiedName

func NewSourceNameFromMaybeQualifiedName(qualifiedName string, defaultSchemaName string) *SourceName

func NewSourceNameFromQualifiedName

func NewSourceNameFromQualifiedName(qualifiedName string) *SourceName

func SetDifference

func SetDifference(a, b []*SourceName) []*SourceName

func (*SourceName) String

func (s *SourceName) String() string

func (*SourceName) ToTargetName

func (s *SourceName) ToTargetName() *TargetName

type TargetName

type TargetName struct {
	ObjectName Identifier
	SchemaName Identifier
	Qualified  Identifier
}

func NewTargetName

func NewTargetName(schemaName, objectName string) *TargetName

func NewTargetNameFromMaybeQualifiedName

func NewTargetNameFromMaybeQualifiedName(qualifiedName string, defaultSchemaName string) *TargetName

func NewTargetNameFromQualifiedName

func NewTargetNameFromQualifiedName(qualifiedName string) *TargetName

func (*TargetName) String

func (t *TargetName) String() string

Jump to

Keyboard shortcuts

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