db

package
v0.0.0-...-53df4c2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package db ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column interface {
	// Change .
	Change()

	// Collation .
	Collation(string) Column

	// Default .
	Default(interface{}) Column

	// Nullable .
	Nullable() Column

	// Index .
	Index() Column
	// Primary .
	Primary() Column
	// Unique .
	Unique() Column

	// References .
	References(table, column string) Column
	// OnDelete .
	OnDelete(action ReferentialAction) Column
	// OnUpdate .
	OnUpdate(action ReferentialAction) Column
}

Column .

type ColumnType

type ColumnType string

ColumnType .

const (
	BigInt      ColumnType = "BIGINT"
	BigSerial   ColumnType = "BIGSERIAL"
	Bit         ColumnType = "BIT"
	VarBit      ColumnType = "VARBIT"
	Bool        ColumnType = "BOOL"
	Char        ColumnType = "CHAR"
	VarChar     ColumnType = "VARCHAR"
	Date        ColumnType = "DATE"
	Float8      ColumnType = "FLOAT8"
	Inet        ColumnType = "INET"
	Int         ColumnType = "INT"
	JSON        ColumnType = "JSON"
	JSONB       ColumnType = "JSONB"
	Real        ColumnType = "REAL"
	SmallInt    ColumnType = "SMALLINT"
	SmallSerial ColumnType = "SMALLSERIAL"
	Serial      ColumnType = "SERIAL"
	Text        ColumnType = "TEXT"
	Time        ColumnType = "TIME"
	TimeTZ      ColumnType = "TIME WITH TIME ZONE"
	Timestamp   ColumnType = "TIMESTAMP"
	TimestampTZ ColumnType = "TIMESTAMP WITH TIME ZONE"
	UUID        ColumnType = "UUID"
)

func (ColumnType) String

func (c ColumnType) String() string

type Constraint

type Constraint interface{}

Constraint .

type ConstraintType

type ConstraintType string

ConstraintType .

const (
	CheckConstraint      ConstraintType = "CHECK"
	PrimaryKeyConstraint ConstraintType = "PRIMARY KEY"
	UniqueConstraint     ConstraintType = "UNIQUE"
)

type DB

type DB interface {
	// Create .
	Create(name string, f func(Table)) error

	// CreateIfExists .
	CreateIfExists(name string, f func(Table)) error

	// Drop .
	Drop(name string) error

	// DropIfExists .
	DropIfExists(name string) error

	// Table .
	Table(name string, f func(Table)) error
}

DB .

func New

func New() DB

New .

type Migration

type Migration interface {
	Up(DB) error
	Down(DB) error
}

Migration .

type Reference

type Reference interface{}

Reference .

type ReferentialAction

type ReferentialAction string

ReferentialAction .

const (
	// Cascade .
	Cascade ReferentialAction = "CASCADE"
	// NoAction .
	NoAction ReferentialAction = "NO ACTION"
	// Restrict .
	Restrict ReferentialAction = "RESTRICT"
	// SetDefault .
	SetDefault ReferentialAction = "SET DEFAULT"
	// SetNull .
	SetNull ReferentialAction = "SET NULL"
)

type Table

type Table interface {
	BigInt(name string) Column
	BigSerial(name string) Column
	Bit(name string) Column
	VarBit(name string, size uint) Column
	Bool(name string) Column
	Char(name string) Column
	VarChar(name string, size uint) Column
	Date(name string) Column
	Float8(name string) Column
	Inet(name string) Column
	Int(name string) Column
	JSON(name string) Column
	JSONB(name string) Column
	Real(name string) Column
	SmallInt(name string) Column
	SmallSerial(name string) Column
	Serial(name string) Column
	Text(name string) Column
	Time(name string) Column
	TimeTZ(name string) Column
	Timestamp(name string) Column
	TimestampTZ(name string) Column
	UUID(name string) Column

	// DropColumns .
	DropColumns(columns ...string)
	// RenameColumn .
	RenameColumn(old, new string)
}

Table .

Directories

Path Synopsis
Package migrations ...
Package migrations ...

Jump to

Keyboard shortcuts

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