database

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2018 License: Apache-2.0 Imports: 1 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 {
	Name         string      // the original name of the column in the DB
	Type         string      // the original type of the column in the DB
	IsArray      bool        // true if the column type is an array
	Length       int         // non-zero if the type has a length (e.g. varchar[16])
	UserDefined  bool        // true if the type is user-defined
	Nullable     bool        // true if the column is not NON NULL
	HasDefault   bool        // true if the column has a default
	Comment      string      // the comment attached to the column
	IsPrimaryKey bool        // true if the column is a primary key
	IsForeignKey bool        // true if the column is a foreign key
	ForeignKey   *ForeignKey // foreign key database definition
	Orig         interface{} // the raw database column data
}

Column contains data about a column in a table.

type Driver

type Driver interface {
	Parse(log *log.Logger, conn string, schemaNames []string, filterTables func(schema, table string) bool) (*Info, error)
}

Driver defines the base interface for databases that are supported by gnorm

type Enum

type Enum struct {
	Table  string       // (mysql) the original name of the table in the DB
	Name   string       // the original name of the enum in the DB
	Values []*EnumValue // the list of possible values for this enum
}

Enum represents a type that has a set of allowed values.

type EnumValue

type EnumValue struct {
	Name  string // the original label of the enum in the DB
	Value int    // the value for this enum value (order)
}

EnumValue is one of the named values for an enum.

type ForeignKey

type ForeignKey struct {
	SchemaName               string // the original name of the schema in the db
	TableName                string // the original name of the table in the db
	ColumnName               string // the original name of the column in the db
	Name                     string // the original name of the foreign key constraint in the db
	UniqueConstraintPosition int    // the position of the unique constraint in the db
	ForeignTableName         string // the original name of the table in the db for the referenced table
	ForeignColumnName        string // the original name of the column in the db for the referenced column
}

ForeignKey contains the definition of a database foreign key

type Index

type Index struct {
	Name     string    // name of the index in the database
	IsUnique bool      // true if the index is unique
	Columns  []*Column // list of columns in this index
}

Index contains the definition of a database index.

type Info

type Info struct {
	Schemas []*Schema // the list of schema info
}

Info is the collection of schema info from a database.

type PrimaryKey

type PrimaryKey struct {
	SchemaName string // the original name of the schema in the db
	TableName  string // the original name of the table in the db
	ColumnName string // the original name of the column in the db
	Name       string // the original name of the key constraint in the db
}

PrimaryKey contains the definition of a database primary key.

type Schema

type Schema struct {
	Name   string   // the original name of the schema in the DB
	Tables []*Table // the list of tables in this schema
	Enums  []*Enum  // the list of enums in this schema
}

Schema is the information on a single named schema in the database.

type Table

type Table struct {
	Name    string    // the original name of the table in the DB
	Comment string    // the comment attached to the table
	Columns []*Column // ordered list of columns in this table
	Indexes []*Index  // list of indexes in this table
}

Table contains the definition of a database table.

Jump to

Keyboard shortcuts

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