dbutils

package
v0.0.0-...-710d95f Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	Unique     bool          `json:"unique"`
	Optional   bool          `json:"optional"`
	SchemaName string        `json:"schemaName"`
	IndexName  string        `json:"indexName"`
	TableName  string        `json:"tableName"`
	Columns    []IndexColumn `json:"columns"`
	Where      string        `json:"where"`
}

Index represents a single parsed SQL CREATE INDEX expression.

func ParseIndex

func ParseIndex(createIndexExpr string) Index

ParseIndex parses the provided "CREATE INDEX" SQL string into Index struct.

func (Index) Build

func (idx Index) Build() string

Build returns a "CREATE INDEX" SQL string from the current index parts.

Returns empty string if idx.IsValid() is false.

func (Index) IsValid

func (idx Index) IsValid() bool

IsValid checks if the current Index contains the minimum required fields to be considered valid.

type IndexColumn

type IndexColumn struct {
	Name    string `json:"name"` // identifier or expression
	Collate string `json:"collate"`
	Sort    string `json:"sort"`
}

IndexColumn represents a single parsed SQL index column.

Jump to

Keyboard shortcuts

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