sql

package
v0.0.0-...-ecd4814 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2021 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 Column

type Column struct {
	Type  FieldType
	Name  string
	Null  bool
	Array bool
}

func (*Column) PrefixName

func (c *Column) PrefixName(prefix string) *Column

func (*Column) Schema

func (c *Column) Schema() string

type FieldType

type FieldType string
const (
	SQLUnknown FieldType = ""

	SQLBoolean FieldType = "boolean"

	SQLSmallInt FieldType = "smallint"
	SQLInteger  FieldType = "integer"
	SQLBigInt   FieldType = "bigint"
	SQLReal     FieldType = "real"
	SQLDouble   FieldType = "double precision"

	SQLText FieldType = "text"

	SQLBytea FieldType = "bytea"

	SQLTimestampTimezone FieldType = "timestamp with time zone"
	SQLTimestamp         FieldType = "timestamp"
	SQLDate              FieldType = "date"
)

See https://www.postgresql.org/docs/current/datatype.html

func ProtoTypeToSQL

func ProtoTypeToSQL(kind protoreflect.Kind) (FieldType, error)

type ForeignKeyConstraint

type ForeignKeyConstraint struct {
	ForeignTableName string
	Columns          []*Column
}

type PrimaryKeyConstraint

type PrimaryKeyConstraint struct {
	Columns []*Column
}

func (*PrimaryKeyConstraint) Schema

func (p *PrimaryKeyConstraint) Schema() string

type Schemer

type Schemer interface {
	Schema() string
}

type Table

type Table struct {
	Name        string
	Columns     []*Column
	Constraints []Schemer
}

func (*Table) Schema

func (t *Table) Schema() string

Jump to

Keyboard shortcuts

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