summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/migrate/sqlschema/table.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-11-25 15:42:37 +0000
committerLibravatar GitHub <noreply@github.com>2024-11-25 15:42:37 +0000
commit3fceb5fc1a83a6ba3ca3c314eef50f0b45cd6009 (patch)
treed9fd78a82ec2352aad47d50cd9176e150f600b07 /vendor/github.com/uptrace/bun/migrate/sqlschema/table.go
parent[bugfix] notification types missing from link header (#3571) (diff)
downloadgotosocial-3fceb5fc1a83a6ba3ca3c314eef50f0b45cd6009.tar.xz
bumps uptrace/bun dependencies to v1.2.6 (#3569)
Diffstat (limited to 'vendor/github.com/uptrace/bun/migrate/sqlschema/table.go')
-rw-r--r--vendor/github.com/uptrace/bun/migrate/sqlschema/table.go60
1 files changed, 60 insertions, 0 deletions
diff --git a/vendor/github.com/uptrace/bun/migrate/sqlschema/table.go b/vendor/github.com/uptrace/bun/migrate/sqlschema/table.go
new file mode 100644
index 000000000..a805ba780
--- /dev/null
+++ b/vendor/github.com/uptrace/bun/migrate/sqlschema/table.go
@@ -0,0 +1,60 @@
+package sqlschema
+
+import (
+ orderedmap "github.com/wk8/go-ordered-map/v2"
+)
+
+type Table interface {
+ GetSchema() string
+ GetName() string
+ GetColumns() *orderedmap.OrderedMap[string, Column]
+ GetPrimaryKey() *PrimaryKey
+ GetUniqueConstraints() []Unique
+}
+
+var _ Table = (*BaseTable)(nil)
+
+// BaseTable is a base table definition.
+//
+// Dialects and only dialects can use it to implement the Table interface.
+// Other packages must use the Table interface.
+type BaseTable struct {
+ Schema string
+ Name string
+
+ // ColumnDefinitions map each column name to the column definition.
+ Columns *orderedmap.OrderedMap[string, Column]
+
+ // PrimaryKey holds the primary key definition.
+ // A nil value means that no primary key is defined for the table.
+ PrimaryKey *PrimaryKey
+
+ // UniqueConstraints defined on the table.
+ UniqueConstraints []Unique
+}
+
+// PrimaryKey represents a primary key constraint defined on 1 or more columns.
+type PrimaryKey struct {
+ Name string
+ Columns Columns
+}
+
+func (td *BaseTable) GetSchema() string {
+ return td.Schema
+}
+
+func (td *BaseTable) GetName() string {
+ return td.Name
+}
+
+func (td *BaseTable) GetColumns() *orderedmap.OrderedMap[string, Column] {
+ return td.Columns
+}
+
+func (td *BaseTable) GetPrimaryKey() *PrimaryKey {
+ return td.PrimaryKey
+}
+
+func (td *BaseTable) GetUniqueConstraints() []Unique {
+ return td.UniqueConstraints
+}