schema

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package schema contains types to describe a database schema.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	// Name specifies the column name.
	Name string
	// GoType specifies the type in Go and should be set to a specific Go type.
	GoType interface{}
	// SqlType specifies the type in SQL and can be set to a string describing the SQL type.
	SqlType string
}

Column describes a database column.

func (Column) String

func (me Column) String() string

String describes the column as a string.

type Index

type Index struct {
	// Name specifies the index name.
	Name string
	// Columns contains the columns in the index.
	Columns []Column
	// IsPrimary is true if the index represents a primary key; if IsPrimary is true then
	// IsUnique is also true.
	IsPrimary bool
	// IsUnique is true if the index represents a unique key.
	IsUnique bool
}

Index describes a database index.

func (Index) String

func (me Index) String() string

String describes the index as a string.

type Table

type Table struct {
	// Name specifies the database table name.
	Name string
	// Columns represents the table columns.
	Columns []Column
	// PrimaryKey is the index describing the table's primary key if it has one.
	// A primary key - by definition - is a unique index; however it is not also
	// stored in the Unique field.
	PrimaryKey Index
	// Unique is a slice of unique indexes on the table.
	Unique []Index
}

Table describes a database table.

func (Table) String

func (me Table) String() string

String describes the table as a string.

Jump to

Keyboard shortcuts

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