Documentation
¶
Index ¶
- Constants
- func IsCheck(c string) bool
- func IsForeignKey(c string) bool
- func IsIndex(c string) bool
- func IsPrimaryKey(c string) bool
- func IsUnique(c string) bool
- func JoinColumns(columns Columns, sep string) string
- type Attribute
- type BaseType
- func TypeBool() BaseType
- func TypeBytea() BaseType
- func TypeCharacter(l int) BaseType
- func TypeDate() BaseType
- func TypeDecimal(precision, scale int) BaseType
- func TypeDoubleArray(l int) BaseType
- func TypeDoublePrecision() BaseType
- func TypeInteger() BaseType
- func TypeIntegerArray(l int) BaseType
- func TypeIntegerBig() BaseType
- func TypeIntegerBigArray(l int) BaseType
- func TypeIntegerSmall() BaseType
- func TypeIntegerSmallArray(l int) BaseType
- func TypeJSON() BaseType
- func TypeJSONB() BaseType
- func TypeNumeric(precision, scale int) BaseType
- func TypeReal() BaseType
- func TypeSerial() BaseType
- func TypeSerialBig() BaseType
- func TypeSerialSmall() BaseType
- func TypeText() BaseType
- func TypeTextArray(l int) BaseType
- func TypeTimestamp() BaseType
- func TypeTimestampTZ() BaseType
- func TypeUUID() BaseType
- func TypeVarchar(l int) BaseType
- type Column
- type ColumnOption
- func WithCheck(ch string) ColumnOption
- func WithCollate(cl string) ColumnOption
- func WithColumnShortName(s string) ColumnOption
- func WithDefault(d string, e ...Event) ColumnOption
- func WithIndex() ColumnOption
- func WithNotNull() ColumnOption
- func WithOnDelete(on int32) ColumnOption
- func WithOnUpdate(on int32) ColumnOption
- func WithPrimaryKey() ColumnOption
- func WithReference(r *Column, opts ...RelationshipOption) ColumnOption
- func WithTypeMapping(t Type) ColumnOption
- func WithUnique() ColumnOption
- type Columns
- type CompositeType
- type Constraint
- func Check(table *Table, check string, columns ...*Column) *Constraint
- func ForeignKey(primaryColumns, referenceColumns Columns, opts ...ConstraintOption) *Constraint
- func Index(table *Table, columns ...*Column) *Constraint
- func PrimaryKey(table *Table, columns ...*Column) *Constraint
- func Unique(table *Table, columns ...*Column) *Constraint
- func UniqueIndex(table *Table, methodSuffix, where string, columns ...*Column) *Constraint
- type ConstraintOption
- type ConstraintType
- type Constraints
- type EnumeratedType
- type Event
- type Function
- type FunctionArg
- type FunctionBehaviour
- type MappableType
- type PseudoType
- type Reference
- type Relationship
- type RelationshipOption
- func WithBidirectional() RelationshipOption
- func WithColumnName(n string) RelationshipOption
- func WithForeignKey(primaryColumns, referenceColumns Columns, opts ...ConstraintOption) RelationshipOption
- func WithInversedForeignKey(primaryColumns, referenceColumns Columns, opts ...ConstraintOption) RelationshipOption
- func WithInversedName(s string) RelationshipOption
- func WithOwnerForeignKey(primaryColumns, referenceColumns Columns, opts ...ConstraintOption) RelationshipOption
- func WithOwnerName(s string) RelationshipOption
- type RelationshipType
- type Schema
- type SchemaOption
- type Table
- func (t *Table) AddCheck(check string, columns ...*Column) *Table
- func (t *Table) AddColumn(c *Column) *Table
- func (t *Table) AddConstraint(c *Constraint) *Table
- func (t *Table) AddIndex(columns ...*Column) *Table
- func (t *Table) AddRelationship(r *Relationship, opts ...ColumnOption) *Table
- func (t *Table) AddUnique(columns ...*Column) *Table
- func (t *Table) AddUniqueIndex(methodSuffix, where string, columns ...*Column) *Table
- func (t *Table) FullName() string
- func (t *Table) PrimaryKey() (*Column, bool)
- func (t *Table) SetIfNotExists(ine bool) *Table
- func (t *Table) SetSchema(s *Schema) *Table
- type TableOption
- type Type
Constants ¶
const ( // RelationshipTypeOneToOne is a relationship that each row in one database table is linked to 1 and only 1 other row in another table. // In a one-to-one relationship between Table A and Table B, each row in Table A is linked to another row in Table B. // The number of rows in Table A must equal the number of rows in Table B RelationshipTypeOneToOne RelationshipType = iota // RelationshipTypeOneToMany is a relationship that each row in the related to table can be related to many rows in the relating table. // This allows frequently used information to be saved only once in a table and referenced many times in all other tables. RelationshipTypeOneToMany // RelationshipTypeManyToOne works like one to many, but it points to another owner. RelationshipTypeManyToOne // RelationshipTypeManyToMany is combination of two many to one relationships. // Needs proxy table. RelationshipTypeManyToMany // NoAction produce an error indicating that the deletion or update would create a foreign key constraint violation. // If the constraint is deferred, this error will be produced at constraint check time if there still exist any referencing rows. // This is the default action. NoAction int32 = iota // Restrict produce an error indicating that the deletion or update would create a foreign key constraint violation. // This is the same as NO ACTION except that the check is not deferrable. Restrict // Cascade delete any rows referencing the deleted row, // or update the values of the referencing column(s) to the new values of the referenced columns, respectively. Cascade // SetNull set the referencing column(s) to null SetNull // SetDefault set the referencing column(s) to their default values. // (There must be a row in the referenced table matching the default values, if they are not null, or the operation will fail SetDefault )
Variables ¶
This section is empty.
Functions ¶
func IsForeignKey ¶
IsForeignKey returns true if string has suffix "_fkey".
func IsPrimaryKey ¶
IsPrimaryKey returns true if string has suffix "_pkey".
Types ¶
type Attribute ¶
type Attribute struct {
Name, Collate, Default, Check string
NotNull, Unique, PrimaryKey bool
Schema *Schema
Type Type
}
Attribute ...
type BaseType ¶
type BaseType struct {
// contains filtered or unexported fields
}
BaseType ...
func TypeCharacter ¶
TypeCharacter is physically padded with spaces to the specified width n, and are stored and displayed that way.
func TypeDate ¶ added in v0.25.1
func TypeDate() BaseType
TypeDate is a date only (no time, no time zone).
func TypeDoubleArray ¶
TypeDoubleArray is an array of double precision floating-point numbers.
func TypeDoublePrecision ¶
func TypeDoublePrecision() BaseType
TypeDoublePrecision is a numeric type with 15 decimal digits precision.
func TypeInteger ¶
func TypeInteger() BaseType
TypeInteger is the common choice, as it offers the best balance between range, storage size, and performance.
func TypeIntegerArray ¶
TypeIntegerArray is an array of integers.
func TypeIntegerBig ¶
func TypeIntegerBig() BaseType
TypeIntegerBig is designed to be used when the range of the TypeInteger is insufficient.
func TypeIntegerBigArray ¶
TypeIntegerBigArray is an array of big integers.
func TypeIntegerSmall ¶
func TypeIntegerSmall() BaseType
TypeIntegerSmall is generally only used if disk space is at a premium.
func TypeIntegerSmallArray ¶
TypeIntegerSmallArray is an array of small integers.
func TypeJSON ¶
func TypeJSON() BaseType
TypeJSON is for storing JSON (JavaScript Object Notation) data, as specified in RFC 7159. Such data can also be stored as text, but the JSON data types have the advantage of enforcing that each stored value is valid according to the JSON rules.
func TypeJSONB ¶
func TypeJSONB() BaseType
TypeJSONB in compare to TypeJSON is stored in a decomposed binary format that makes it slightly slower to input due to added conversion overhead, but significantly faster to process, since no reparsing is needed. JSONB also supports indexing, which can be a significant advantage.
func TypeNumeric ¶
TypeNumeric can store numbers with a very large number of digits. It is especially recommended for storing monetary amounts and other quantities where exactness is required. Calculations with numeric values yield exact results where possible, e.g. addition, subtraction, multiplication. However, calculations on numeric values are very slow compared to the integer types, or to the floating-point types described in the next section.
func TypeReal ¶
func TypeReal() BaseType
TypeReal represents single precision floating-point numbers. In postgres it is stored as 4-byte single-precision floating point numbers.
func TypeSerial ¶
func TypeSerial() BaseType
TypeSerial is an auto-incrementing integer. It is generally used to store the primary key of a table. To specify that a column is to be used as a serial column, declare it as type SERIAL. Note that, even though SERIAL appears to be a column type, it is actually shorthand notation that tells PostgreSQL to create a auto-incrementing column behind the scenes.
func TypeSerialBig ¶
func TypeSerialBig() BaseType
TypeSerialBig is an auto-incrementing big integer. It is generally used to store the primary key of a table. To specify that a column is to be used as a serial column, declare it as type BIGSERIAL. Note that, even though BIGSERIAL appears to be a column type, it is actually shorthand notation that tells PostgreSQL to create a auto-incrementing column behind the scenes.
func TypeSerialSmall ¶
func TypeSerialSmall() BaseType
TypeSerialSmall is an auto-incrementing small integer. It is generally used to store the primary key of a table. To specify that a column is to be used as a serial column, declare it as type SMALLSERIAL. Note that, even though SMALLSERIAL appears to be a column type, it is actually shorthand notation that tells PostgreSQL to create a auto-incrementing column behind the scenes.
func TypeTimestampTZ ¶
func TypeTimestampTZ() BaseType
TypeTimestampTZ is a date and time, including time zone
func TypeUUID ¶
func TypeUUID() BaseType
TypeUUID stores Universally Unique Identifiers (UUID) as defined by RFC 4122, ISO/IEC 9834-8:2005, and related standards. (Some systems refer to this data type as a globally unique identifier, or GUID, instead.) This identifier is a 128-bit quantity that is generated by an algorithm chosen to make it very unlikely that the same identifier will be generated by anyone else in the known universe using the same algorithm. Therefore, for distributed systems, these identifiers provide a better uniqueness guarantee than sequence generators, which are only unique within a single database.
func TypeVarchar ¶
TypeVarchar is a character varying(n), where n is a positive integer.
func (BaseType) Fingerprint ¶
Fingerprint implements Type interface.
type Column ¶
type Column struct { // Name is a column name. Name string // ShortName is a column short name. It is used in queries when column name is ambiguous. ShortName string // Collate is a collation for column. // It allows to specify the collation order for character data. Collate string // Check is a check constraint. // It allows to specify a predicate that must be satisfied by each row of the table. Check string // Default is a default value for column for given event. // For example for insert event it will be used when no value is provided. Default map[Event]string // NotNull if true means that column cannot be null. NotNull bool // Unique if true means that column value must be unique. Unique bool // PrimaryKey if true means that column is a primary key. PrimaryKey bool // Index if true means that column is indexed. Index bool // Type is a column type. Type Type // Table is a table that column belongs to. Table *Table // Reference is a column that this column references. Reference *Column // ReferenceOptions are options for reference. ReferenceOptions []RelationshipOption // Match is a match option for foreign key constraint. Match int32 // OnDelete is a ON DELETE clause that specifies the action to perform when a referenced row in the referenced table is being deleted. OnDelete int32 // OnUpdate is a ON UPDATE clause that specifies the action to perform when a referenced column in the referenced table is being updated to a new value. OnUpdate int32 // NoInherit if true means that column is not inherited by child tables. NoInherit bool DeferrableInitiallyDeferred bool DeferrableInitiallyImmediate bool // IsDynamic if true means that column is not stored in database, but is dynamically created using function. IsDynamic bool // Func is a function that is used to create dynamic column. Func *Function // Columns are columns that are used by dynamic column function. Columns Columns }
Column describes database column.
func NewColumn ¶
func NewColumn(n string, t Type, opts ...ColumnOption) *Column
NewColumn initializes new instance of Column.
func NewDynamicColumn ¶ added in v0.13.0
NewDynamicColumn initializes new instance of Column that is created using function.
type ColumnOption ¶
type ColumnOption func(*Column)
ColumnOption configures how we set up the column.
func WithColumnShortName ¶ added in v0.3.0
func WithColumnShortName(s string) ColumnOption
WithColumnShortName ...
func WithOnDelete ¶
func WithOnDelete(on int32) ColumnOption
WithOnDelete add ON DELETE clause that specifies the action to perform when a referenced row in the referenced table is being deleted
func WithOnUpdate ¶
func WithOnUpdate(on int32) ColumnOption
WithOnUpdate add ON UPDATE clause that specifies the action to perform when a referenced column in the referenced table is being updated to a new value.
func WithReference ¶
func WithReference(r *Column, opts ...RelationshipOption) ColumnOption
WithReference ...
type Columns ¶
type Columns []*Column
Columns is a slice of columns that implements few handy methods.
type CompositeType ¶
type CompositeType struct { Attributes []*Attribute // contains filtered or unexported fields }
CompositeType represents the structure of a row or record. It is essentially just a list of field names and their data types. PostgreSQL allows composite types to be used in many of the same ways that simple types can be used. For example, a column of a table can be declared to be of a composite type. EXPERIMENTAL
func TypeComposite ¶
func TypeComposite(name string, attributes ...*Attribute) CompositeType
TypeComposite allocates CompositeType with given name and attributes.
func (CompositeType) Fingerprint ¶
func (ct CompositeType) Fingerprint() string
Fingerprint implements Type interface.
func (CompositeType) String ¶
func (ct CompositeType) String() string
String implements Stringer interface.
type Constraint ¶
type Constraint struct { Type ConstraintType Where, Check string PrimaryTable, Table *Table PrimaryColumns, Columns Columns Attribute []*Attribute Match, OnDelete, OnUpdate int32 NoInherit, DeferrableInitiallyDeferred, DeferrableInitiallyImmediate bool MethodSuffix string }
Constraint ...
func ForeignKey ¶
func ForeignKey(primaryColumns, referenceColumns Columns, opts ...ConstraintOption) *Constraint
ForeignKey constraint specifies that the values in a column (or a group of columns) must match the values appearing in some row of another table. We say this maintains the referential integrity between two related tables.
func PrimaryKey ¶
func PrimaryKey(table *Table, columns ...*Column) *Constraint
PrimaryKey constraint is simply a combination of a unique constraint and a not-null constraint.
func Unique ¶
func Unique(table *Table, columns ...*Column) *Constraint
Unique constraint ensure that the data contained in a column or a group of columns is unique with respect to all the rows in the table.
func UniqueIndex ¶ added in v0.22.0
func UniqueIndex(table *Table, methodSuffix, where string, columns ...*Column) *Constraint
UniqueIndex ...
func (*Constraint) String ¶
func (c *Constraint) String() string
String implements Stringer interface.
type ConstraintType ¶ added in v0.15.0
type ConstraintType string
const ( // ConstraintTypeUnknown ... ConstraintTypeUnknown ConstraintType = "unknown" // ConstraintTypePrimaryKey ... ConstraintTypePrimaryKey ConstraintType = "pkey" // ConstraintTypeCheck ... ConstraintTypeCheck ConstraintType = "check" // ConstraintTypeUnique ... ConstraintTypeUnique ConstraintType = "key" // ConstraintTypeIndex ... ConstraintTypeIndex ConstraintType = "idx" // ConstraintTypeForeignKey ... ConstraintTypeForeignKey ConstraintType = "fkey" // ConstraintTypeExclusion ... ConstraintTypeExclusion ConstraintType = "excl" // ConstraintTypeUniqueIndex ... ConstraintTypeUniqueIndex ConstraintType = "uidx" )
type Constraints ¶ added in v0.15.0
type Constraints []*Constraint
func (Constraints) CountOf ¶ added in v0.15.0
func (c Constraints) CountOf(types ...ConstraintType) int
CountOf returns number of constraints of given type. If nothing is given return length of entire slice.
type EnumeratedType ¶
type EnumeratedType struct { Enums []string // contains filtered or unexported fields }
EnumeratedType is a data type consisting of a set of named values called elements, members, enumeral, or enumerators of the type. EXPERIMENTAL
func TypeEnumerated ¶
func TypeEnumerated(name string, enums ...string) EnumeratedType
TypeEnumerated initializes EnumeratedType with given name and enums.
func (EnumeratedType) Fingerprint ¶
func (et EnumeratedType) Fingerprint() string
Fingerprint implements Type interface.
func (EnumeratedType) String ¶
func (et EnumeratedType) String() string
String implements Stringer interface.
type Function ¶
type Function struct { Name string BuiltIn bool Type Type Body string Behaviour FunctionBehaviour Args []*FunctionArg }
Function describes database function.
func FunctionNow ¶
func FunctionNow() *Function
FunctionNow is a helper function that creates now() function. Now() returns current timestamp with time zone (abbreviated as timestamptz).
type FunctionArg ¶ added in v0.13.0
FunctionArg is a function argument, it is used to describe function signature.
type FunctionBehaviour ¶ added in v0.13.0
type FunctionBehaviour int
FunctionBehaviour is a function behaviour, it can be volatile, immutable or stable.
const ( // FunctionBehaviourVolatile indicates that the function value can change even within a single table scan, // so no optimizations can be made. // Relatively few database functions are volatile in this sense; some examples are random(), currval(), timeofday(). // But note that any function that has side-effects must be classified volatile, even if its result is quite predictable, // to prevent calls from being optimized away; an example is setval(). FunctionBehaviourVolatile FunctionBehaviour = iota // FunctionBehaviourImmutable indicates that the function cannot modify the database and always returns the same result when given the same argument values; // that is, it does not do database lookups or otherwise use information not directly present in its argument list. // If this option is given, any call of the function with all-constant arguments can be immediately replaced with the function value. FunctionBehaviourImmutable // FunctionBehaviourStable indicates that the function cannot modify the database, // and that within a single table scan it will consistently return the same result for the same argument values, // but that its result could change across SQL statements. // This is the appropriate selection for functions whose results depend on database lookups, // parameter variables (such as the current time zone), etc. // (It is inappropriate for AFTER triggers that wish to query rows modified by the current command.) // Also note that the current_timestamp family of functions qualify as stable, since their values do not change within a transaction. FunctionBehaviourStable )
type MappableType ¶
MappableType is a type that can be mapped to other types. It allows
func (MappableType) Fingerprint ¶
func (mt MappableType) Fingerprint() string
Fingerprint implements Type interface.
func (MappableType) String ¶
func (mt MappableType) String() string
String implements Stringer interface.
type PseudoType ¶
type PseudoType struct {
// contains filtered or unexported fields
}
PseudoType ... EXPERIMENTAL
func TypePseudo ¶
func TypePseudo(name string) PseudoType
TypePseudo initializes PseudoType with given name.
func (PseudoType) Fingerprint ¶
func (pt PseudoType) Fingerprint() string
Fingerprint implements Type interface.
func (PseudoType) String ¶
func (pt PseudoType) String() string
String implements Stringer interface.
type Relationship ¶
type Relationship struct { // Bidirectional if true means that relationship is bidirectional. // It is useful when we want to get all related rows from both tables. // If true, the library will generate additional methods for both tables. Bidirectional bool // Type defines relationship type. Type RelationshipType // OwnerName is a name of relationship from owner table perspective. // For example if we have table A and table B and relationship from A to B, // then owner name is a name of relationship from A perspective. // It is a good practice to give descriptive names to relationships. OwnerName string // InversedName is a name of relationship from inversed table perspective. // For example if we have table A and table B and relationship from A to B, // then inversed name is a name of relationship from B perspective. // If not set, the library will generate it automatically. // It is useful when we want to have two relationships between two tables or when table self references itself. // It is a good practice to give descriptive names to relationships. InversedName string OwnerTable, InversedTable, ThroughTable *Table OwnerForeignKey, InversedForeignKey *Constraint OwnerColumns, InversedColumns Columns ColumnName string OnDelete, OnUpdate int32 }
Relationship describes database relationship. Usually it is used to describe foreign key constraint.
func ManyToMany ¶
func ManyToMany(t1 *Table, t2 *Table, opts ...RelationshipOption) *Relationship
ManyToMany is a handy constructor that instantiates basic many-to-many relationship. It can be adjusted using RelationshipOption.
func ManyToOne ¶
func ManyToOne(t *Table, opts ...RelationshipOption) *Relationship
ManyToOne is a handy constructor that instantiates basic many-to-one relationship. It can be adjusted using RelationshipOption.
func OneToMany ¶
func OneToMany(t *Table, opts ...RelationshipOption) *Relationship
OneToMany is a handy constructor that instantiates basic one-to-many relationship. It can be adjusted using RelationshipOption.
func OneToOne ¶
func OneToOne(t *Table, opts ...RelationshipOption) *Relationship
OneToOne is a handy constructor that instantiates basic one-to-one relationship. It can be adjusted using RelationshipOption.
type RelationshipOption ¶
type RelationshipOption func(*Relationship)
RelationshipOption configures how we set up the relationship.
func WithBidirectional ¶
func WithBidirectional() RelationshipOption
WithBidirectional adjust relationship by setting bidirectional flag.
func WithColumnName ¶
func WithColumnName(n string) RelationshipOption
WithColumnName adjust relationship by setting column name.
func WithForeignKey ¶ added in v0.18.0
func WithForeignKey(primaryColumns, referenceColumns Columns, opts ...ConstraintOption) RelationshipOption
WithForeignKey adjust relationship to have foreign key.
func WithInversedForeignKey ¶
func WithInversedForeignKey(primaryColumns, referenceColumns Columns, opts ...ConstraintOption) RelationshipOption
WithInversedForeignKey adjust relationship to have inversed foreign key.
func WithInversedName ¶
func WithInversedName(s string) RelationshipOption
WithInversedName adjust relationship by setting inversed name.
func WithOwnerForeignKey ¶
func WithOwnerForeignKey(primaryColumns, referenceColumns Columns, opts ...ConstraintOption) RelationshipOption
WithOwnerForeignKey ...
func WithOwnerName ¶
func WithOwnerName(s string) RelationshipOption
WithOwnerName adjust relationship by setting owner name.
type RelationshipType ¶
type RelationshipType int
RelationshipType can be used to describe relationship between tables. It can be one to one, one to many, many to one or many to many.
type Schema ¶
type Schema struct { // Name is a schema name. Name string // IfNotExists if true means that schema should be created only if it does not exist. // If true, creation process will not fail if schema already exists. IfNotExists bool // Tables is a collection of tables that schema contains. Tables []*Table // Functions is a collection of functions that schema contains. Functions []*Function // Types is a collection of types that schema contains. Types []Type }
Schema describes database schema. It is a collection of tables, functions and types.
func NewSchema ¶
func NewSchema(name string, opts ...SchemaOption) *Schema
NewSchema initializes new instance of Schema for given name and options.
func (*Schema) AddFunction ¶ added in v0.13.0
AddFunction adds function to schema.
type SchemaOption ¶ added in v0.4.0
type SchemaOption func(*Schema)
SchemaOption configures how we set up a schema.
func WithSchemaIfNotExists ¶ added in v0.4.0
func WithSchemaIfNotExists() SchemaOption
WithSchemaIfNotExists is schema option that sets IfNotExists flag to true.
type Table ¶
type Table struct {
Name, ShortName, Collate, TableSpace string
IfNotExists, Temporary bool
// Schema references parent schema.
Schema *Schema
// Columns is a collection of columns that table contains.
Columns Columns
// Constraints is a collection of constraints that table contains.
Constraints Constraints
// OwnedRelationships is a collection of relationships that table owns.
OwnedRelationships []*Relationship
// InversedRelationships is a collection of relationships that table is inversed in.
InversedRelationships []*Relationship
// ManyToManyRelationships is a collection of relationships that table is inversed in.
ManyToManyRelationships []*Relationship
// contains filtered or unexported fields
}
Table is partially implemented postgres table synopsis.
func NewTable ¶
func NewTable(name string, opts ...TableOption) *Table
NewTable allocates new table using given name and options.
func SelfReference ¶
func SelfReference() *Table
SelfReference returns almost empty table that express self reference. Should be used with relationships.
func (*Table) AddConstraint ¶
func (t *Table) AddConstraint(c *Constraint) *Table
AddConstraint adds constraint to the table.
func (*Table) AddRelationship ¶
func (t *Table) AddRelationship(r *Relationship, opts ...ColumnOption) *Table
AddRelationship adds relationship to the table.
func (*Table) AddUniqueIndex ¶ added in v0.22.0
AddUniqueIndex ...
func (*Table) FullName ¶
FullName if schema is defined returns name in format <schema>.<name> or just <name> if not set.
func (*Table) PrimaryKey ¶
PrimaryKey returns column that is primary key, or false if none.
func (*Table) SetIfNotExists ¶
SetIfNotExists sets IfNotExists flag.
type TableOption ¶
type TableOption func(*Table)
TableOption configures how we set up the table.
func WithTableIfNotExists ¶ added in v0.4.0
func WithTableIfNotExists() TableOption
WithTableIfNotExists is table option that sets IfNotExists flag to true.
func WithTableShortName ¶ added in v0.3.0
func WithTableShortName(s string) TableOption
WithTableShortName pass the short name of the table.
func WithTableSpace ¶
func WithTableSpace(s string) TableOption
WithTableSpace pass the name of the tablespace in which the new table is to be created. If not specified, default_tablespace is consulted, or temp_tablespaces if the table is temporary.
func WithTemporary ¶
func WithTemporary() TableOption
WithTemporary specified, the table is created as a temporary table. Temporary tables are automatically dropped at the end of a session, or optionally at the end of the current transaction (see ON COMMIT below). Existing permanent tables with the same name are not visible to the current session while the temporary table exists, unless they are referenced with schema-qualified names. Any indexes created on a temporary table are automatically temporary as well.