gotosocial/vendor/github.com/uptrace/bun/migrate/sqlschema/table.go
dependabot[bot] 1d8bd30603
[chore]: Bump github.com/uptrace/bun from 1.2.6 to 1.2.8
Bumps [github.com/uptrace/bun](https://github.com/uptrace/bun) from 1.2.6 to 1.2.8.
- [Release notes](https://github.com/uptrace/bun/releases)
- [Changelog](https://github.com/uptrace/bun/blob/master/CHANGELOG.md)
- [Commits](https://github.com/uptrace/bun/compare/v1.2.6...v1.2.8)

---
updated-dependencies:
- dependency-name: github.com/uptrace/bun
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-14 13:12:55 +00:00

60 lines
1.3 KiB
Go

package sqlschema
import (
"github.com/uptrace/bun/internal/ordered"
)
type Table interface {
GetSchema() string
GetName() string
GetColumns() *ordered.Map[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 *ordered.Map[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() *ordered.Map[string, Column] {
return td.Columns
}
func (td *BaseTable) GetPrimaryKey() *PrimaryKey {
return td.PrimaryKey
}
func (td *BaseTable) GetUniqueConstraints() []Unique {
return td.UniqueConstraints
}