catalog

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Argument

type Argument struct {
	Name       string
	Type       *ast.TypeName
	HasDefault bool
	Mode       ast.FuncParamMode
}

type Catalog

type Catalog struct {
	Comment       string
	DefaultSchema string
	Name          string
	Schemas       []*Schema
	SearchPath    []string
	LoadExtension func(string) *Schema

	// TODO: un-export
	Extensions map[string]struct{}
}

Catalog describes a database instance consisting of metadata in which database objects are defined

func New

func New(defaultSchema string) *Catalog

New creates a new catalog

func (*Catalog) Build

func (c *Catalog) Build(stmts []ast.Statement) error

func (*Catalog) GetTable added in v1.4.0

func (c *Catalog) GetTable(rel *ast.TableName) (Table, error)

func (*Catalog) ListFuncsByName added in v1.4.0

func (c *Catalog) ListFuncsByName(rel *ast.FuncName) ([]Function, error)

func (*Catalog) ResolveFuncCall added in v1.5.0

func (c *Catalog) ResolveFuncCall(call *ast.FuncCall) (*Function, error)

func (*Catalog) Update added in v1.4.0

func (c *Catalog) Update(stmt ast.Statement, colGen columnGenerator) error

type Column

type Column struct {
	Name      string
	Type      ast.TypeName
	IsNotNull bool
	IsArray   bool
	Comment   string
	Length    *int
}

Column describes a set of data values of a particular type in a relational database table

TODO: Should this just be ast Nodes?

type CompositeType added in v1.4.0

type CompositeType struct {
	Name    string
	Comment string
}

func (*CompositeType) SetComment added in v1.4.0

func (ct *CompositeType) SetComment(c string)

type Enum

type Enum struct {
	Name    string
	Vals    []string
	Comment string
}

func (*Enum) SetComment

func (e *Enum) SetComment(c string)

type Function

type Function struct {
	Name               string
	Args               []*Argument
	ReturnType         *ast.TypeName
	Comment            string
	Desc               string
	ReturnTypeNullable bool
}

Function describes a database function

A database function is a method written to perform a specific operation on data within the database.

func (*Function) InArgs added in v1.4.0

func (f *Function) InArgs() []*Argument

type Schema

type Schema struct {
	Name   string
	Tables []*Table
	Types  []Type
	Funcs  []*Function

	Comment string
}

Schema describes how the data in a relational database may relate to other tables or other data models

type Table

type Table struct {
	Rel     *ast.TableName
	Columns []*Column
	Comment string
}

Table describes a relational database table

A database table is a collection of related data held in a table format within a database. It consists of columns and rows.

type Type

type Type interface {
	SetComment(string)
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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