Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Check ¶
type Check struct { Name string `hcl:"name,optional"` Expression string `hcl:"expression,attr"` Deferrable bool `hcl:"deferrable,optional"` InitiallyDeferred bool `hcl:"initially_deferred,optional"` }
A Check constraint limits column values
func ParseCheck ¶
type Column ¶
type Column struct { Name string `hcl:"name,label"` Type string `hcl:"type,attr"` NotNull bool `hcl:"not_null,optional"` Default string `hcl:"default,optional"` }
A Column is a data field of a table
type Database ¶
type Database struct { Parameters *Parameters `hcl:"parameters,block"` Schemas []*Schema `hcl:"schema,block"` Functions []*Function `hcl:"function,block"` Tables []*Table `hcl:"table,block"` Indexes []*Index `hcl:"index,block"` Triggers []*Trigger `hcl:"trigger,block"` }
Database describes a PostgreSQL database
func ParseBytes ¶
ParseBytes converts HCL data to structs describing a database. The filename is used for error messages.
type ForeignKey ¶
type ForeignKey struct { Name string `hcl:"name,optional"` Table string `hcl:"table,label"` Columns []string `hcl:"columns,attr"` Referenced []string `hcl:"referenced,attr"` Match string `hcl:"match,optional"` OnDelete string `hcl:"on_delete,optional"` OnUpdate string `hcl:"on_update,optional"` Deferrable bool `hcl:"deferrable,optional"` InitiallyDeferred bool `hcl:"initially_deferred,optional"` }
A ForeignKey ensures referential integrity
func ParseForeignKey ¶
func ParseForeignKey(data string) (*ForeignKey, error)
type Function ¶
type Function struct { Schema string `hcl:"schema,label"` Name string `hcl:"name,label"` Comment string `hcl:"comment,optional"` Owner string `hcl:"owner,optional"` Returns string `hcl:"returns,attr"` Language string `hcl:"language,attr"` Definition string `hcl:"definition,attr"` }
A Function describes reusable behavior run on the server
type Index ¶
type Index struct { Schema string `hcl:"schema,label"` Table string `hcl:"table,label"` Name string `hcl:"name,label"` Primary bool `hcl:"primary,optional"` Unique bool `hcl:"unique,optional"` Using string `hcl:"using,optional"` Where string `hcl:"where,optional"` Keys []*IndexKey `hcl:"key,block"` }
An Index is used to enhance database performance
func ParseIndex ¶
type IndexKey ¶
type IndexKey struct { Column string `hcl:"column,optional"` Expression string `hcl:"expression,optional"` OpClass string `hcl:"opclass,optional"` Descending bool `hcl:"descending,optional"` }
An IndexKey is used to enhance database performance
type Parameters ¶
type Parameters struct { SearchPath []string `hcl:"search_path,optional"` Timezone string `hcl:"timezone,optional"` }
Parameters describes database-level configuration options
type Schema ¶
type Schema struct { Name string `hcl:"name,label"` Comment string `hcl:"comment,optional"` Owner string `hcl:"owner,optional"` }
A Schema is a database namespace
type Table ¶
type Table struct { Schema string `hcl:"schema,label"` Name string `hcl:"name,label"` Comment string `hcl:"comment,optional"` Owner string `hcl:"owner,optional"` Columns []*Column `hcl:"column,block"` Checks []*Check `hcl:"check,block"` ForeignKeys []*ForeignKey `hcl:"foreign_key,block"` }
A Table is a collection of similar data organized as rows
type Trigger ¶
type Trigger struct { Schema string `hcl:"schema,label"` Table string `hcl:"table,label"` Name string `hcl:"name,label"` Function string `hcl:"function,attr"` When string `hcl:"when,attr"` Constraint bool `hcl:"constraint,optional"` Deferrable bool `hcl:"deferrable,optional"` InitiallyDeferred bool `hcl:"initially_deferred,optional"` ForEachRow bool `hcl:"for_each_row,optional"` Delete bool `hcl:"delete,optional"` Insert bool `hcl:"insert,optional"` Truncate bool `hcl:"truncate,optional"` Update bool `hcl:"update,optional"` Columns []string `hcl:"columns,optional"` }
A Trigger executes a function when a specific event happens
func ParseTrigger ¶
Click to show internal directories.
Click to hide internal directories.