postgres

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2021 License: Apache-2.0 Imports: 14 Imported by: 54

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(phrase string) *sqlx.Builder

Build instantiates a new builder and writes the given phrase to it.

func MarshalSpec

func MarshalSpec(v interface{}, marshaler schemaspec.Marshaler) ([]byte, error)

MarshalSpec marshals v into an Atlas DDL document using a schemaspec.Marshaler.

func UnmarshalSpec

func UnmarshalSpec(data []byte, unmarshaler schemaspec.Unmarshaler, v interface{}) error

UnmarshalSpec unmarshals an Atlas DDL document using an unmarshaler into v.

Types

type ArrayType

type ArrayType struct {
	schema.Type
	T string
}

ArrayType defines an array type. https://www.postgresql.org/docs/current/arrays.html

type BitType

type BitType struct {
	schema.Type
	T   string
	Len int64
}

BitType defines a bit type. https://www.postgresql.org/docs/current/datatype-bit.html

type CType

type CType struct {
	schema.Attr
	V string
}

CType describes the character classification setting (LC_CTYPE).

type Check

type Check struct {
	schema.Attr
	Name      string
	Clause    string
	NoInherit bool
	Columns   []string
}

Check attributes defines a CHECK constraint. https://www.postgresql.org/docs/current/catalog-pg-constraint.html

type ConType

type ConType struct {
	schema.Attr
	T string // c, f, p, u, t, x.
}

ConType describes constraint type. https://www.postgresql.org/docs/current/catalog-pg-constraint.html

type CurrencyType

type CurrencyType struct {
	schema.Type
	T string
}

A CurrencyType defines a currency type.

type Driver

type Driver struct {
	schema.ExecQuerier
	// contains filtered or unexported fields
}

Driver represents a PostgreSQL driver for introspecting database schemas and apply migrations changes on them.

func Open

func Open(db schema.ExecQuerier) (*Driver, error)

Open opens a new PostgreSQL driver.

func (*Driver) Diff

func (d *Driver) Diff() schema.Differ

Diff returns a PostgreSQL schema differ.

func (*Driver) FormatType

func (d *Driver) FormatType(t schema.Type) (string, error)

FormatType converts schema type to its column form in the database. An error is returned if the type cannot be recognized.

func (*Driver) InspectRealm

func (d *Driver) InspectRealm(ctx context.Context, opts *schema.InspectRealmOption) (*schema.Realm, error)

InspectRealm returns schema descriptions of all resources in the given realm.

func (*Driver) InspectSchema

func (d *Driver) InspectSchema(ctx context.Context, name string, opts *schema.InspectOptions) (*schema.Schema, error)

InspectSchema returns schema descriptions of all tables in the given schema.

func (*Driver) InspectTable

func (d *Driver) InspectTable(ctx context.Context, name string, opts *schema.InspectTableOptions) (*schema.Table, error)

InspectTable returns the schema description of the given table.

func (*Driver) Migrate

func (d *Driver) Migrate() schema.Execer

Migrate returns a PostgreSQL schema executor.

type EnumType

type EnumType struct {
	schema.Type
	T      string // Type name.
	ID     int64  // Type id.
	Values []string
}

EnumType represents an enum type.

type Identity

type Identity struct {
	schema.Attr
	Generation string // ALWAYS, BY DEFAULT.
}

Identity defines an identity column.

type IndexColumnProperty

type IndexColumnProperty struct {
	schema.Attr
	Asc        bool
	Desc       bool
	NullsFirst bool
	NullsLast  bool
}

IndexColumnProperty describes an index column property. https://www.postgresql.org/docs/current/functions-info.html#FUNCTIONS-INFO-INDEX-COLUMN-PROPS

type IndexPredicate

type IndexPredicate struct {
	schema.Attr
	P string
}

IndexPredicate describes a partial index predicate. https://www.postgresql.org/docs/current/catalog-pg-index.html

type IndexType

type IndexType struct {
	schema.Attr
	T string // BTREE, BRIN, HASH, GiST, SP-GiST, GIN.
}

IndexType represents an index type. https://www.postgresql.org/docs/current/indexes-types.html

type NetworkType

type NetworkType struct {
	schema.Type
	T   string
	Len int64
}

A NetworkType defines a network type. https://www.postgresql.org/docs/current/datatype-net-types.html

type SeqFuncExpr

type SeqFuncExpr struct {
	schema.Expr
	X string
}

SeqFuncExpr describe a sequence generator function. https://www.postgresql.org/docs/current/functions-sequence.html

type SerialType

type SerialType struct {
	schema.Type
	T         string
	Precision int
}

A SerialType defines a serial type.

type UUIDType

type UUIDType struct {
	schema.Type
	T string
}

A UUIDType defines a UUID type.

type UserDefinedType

type UserDefinedType struct {
	schema.Type
	T string
}

UserDefinedType defines a user-defined type attribute.

type XMLType

type XMLType struct {
	schema.Type
	T string
}

A XMLType defines an XML type.

Jump to

Keyboard shortcuts

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