Add generated Bob database integration
This commit is contained in:
parent
8203c50b08
commit
7c4a181cdf
32 changed files with 5128 additions and 2 deletions
83
dbinfo/bob_types.bob.go
Normal file
83
dbinfo/bob_types.bob.go
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
// Code generated by BobGen psql v0.41.1. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package dbinfo
|
||||
|
||||
import "github.com/aarondl/opt/null"
|
||||
|
||||
type Table[Cols columns, Idxs indexes, FKs foreignKeys, U uniques, C checks] struct {
|
||||
Schema string
|
||||
Name string
|
||||
Columns Cols
|
||||
Indexes Idxs
|
||||
PrimaryKey *constraint
|
||||
ForeignKeys FKs
|
||||
Uniques U
|
||||
Checks C
|
||||
Comment string
|
||||
}
|
||||
|
||||
type columns interface {
|
||||
AsSlice() []column
|
||||
}
|
||||
|
||||
type column struct {
|
||||
Name string
|
||||
DBType string
|
||||
Default string
|
||||
Comment string
|
||||
Nullable bool
|
||||
Generated bool
|
||||
AutoIncr bool
|
||||
}
|
||||
|
||||
type indexes interface {
|
||||
AsSlice() []index
|
||||
}
|
||||
|
||||
type index struct {
|
||||
Type string
|
||||
Name string
|
||||
Columns []indexColumn
|
||||
Unique bool
|
||||
Comment string
|
||||
NullsFirst []bool
|
||||
NullsDistinct bool
|
||||
Where string
|
||||
Include []string
|
||||
}
|
||||
|
||||
type indexColumn struct {
|
||||
Name string
|
||||
Desc null.Val[bool]
|
||||
IsExpression bool
|
||||
}
|
||||
|
||||
type constraint struct {
|
||||
Name string
|
||||
Columns []string
|
||||
Comment string
|
||||
}
|
||||
|
||||
type foreignKeys interface {
|
||||
AsSlice() []foreignKey
|
||||
}
|
||||
|
||||
type foreignKey struct {
|
||||
constraint
|
||||
ForeignTable string
|
||||
ForeignColumns []string
|
||||
}
|
||||
|
||||
type uniques interface {
|
||||
AsSlice() []constraint
|
||||
}
|
||||
|
||||
type checks interface {
|
||||
AsSlice() []check
|
||||
}
|
||||
|
||||
type check struct {
|
||||
constraint
|
||||
Expression string
|
||||
}
|
||||
122
dbinfo/goose_db_version.bob.go
Normal file
122
dbinfo/goose_db_version.bob.go
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
// Code generated by BobGen psql v0.41.1. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package dbinfo
|
||||
|
||||
import "github.com/aarondl/opt/null"
|
||||
|
||||
var GooseDBVersions = Table[
|
||||
gooseDBVersionColumns,
|
||||
gooseDBVersionIndexes,
|
||||
gooseDBVersionForeignKeys,
|
||||
gooseDBVersionUniques,
|
||||
gooseDBVersionChecks,
|
||||
]{
|
||||
Schema: "",
|
||||
Name: "goose_db_version",
|
||||
Columns: gooseDBVersionColumns{
|
||||
ID: column{
|
||||
Name: "id",
|
||||
DBType: "integer",
|
||||
Default: "IDENTITY",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
VersionID: column{
|
||||
Name: "version_id",
|
||||
DBType: "bigint",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
IsApplied: column{
|
||||
Name: "is_applied",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Tstamp: column{
|
||||
Name: "tstamp",
|
||||
DBType: "timestamp without time zone",
|
||||
Default: "now()",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
},
|
||||
Indexes: gooseDBVersionIndexes{
|
||||
GooseDBVersionPkey: index{
|
||||
Type: "btree",
|
||||
Name: "goose_db_version_pkey",
|
||||
Columns: []indexColumn{
|
||||
{
|
||||
Name: "id",
|
||||
Desc: null.FromCond(false, true),
|
||||
IsExpression: false,
|
||||
},
|
||||
},
|
||||
Unique: true,
|
||||
Comment: "",
|
||||
NullsFirst: []bool{false},
|
||||
NullsDistinct: false,
|
||||
Where: "",
|
||||
Include: []string{},
|
||||
},
|
||||
},
|
||||
PrimaryKey: &constraint{
|
||||
Name: "goose_db_version_pkey",
|
||||
Columns: []string{"id"},
|
||||
Comment: "",
|
||||
},
|
||||
|
||||
Comment: "",
|
||||
}
|
||||
|
||||
type gooseDBVersionColumns struct {
|
||||
ID column
|
||||
VersionID column
|
||||
IsApplied column
|
||||
Tstamp column
|
||||
}
|
||||
|
||||
func (c gooseDBVersionColumns) AsSlice() []column {
|
||||
return []column{
|
||||
c.ID, c.VersionID, c.IsApplied, c.Tstamp,
|
||||
}
|
||||
}
|
||||
|
||||
type gooseDBVersionIndexes struct {
|
||||
GooseDBVersionPkey index
|
||||
}
|
||||
|
||||
func (i gooseDBVersionIndexes) AsSlice() []index {
|
||||
return []index{
|
||||
i.GooseDBVersionPkey,
|
||||
}
|
||||
}
|
||||
|
||||
type gooseDBVersionForeignKeys struct{}
|
||||
|
||||
func (f gooseDBVersionForeignKeys) AsSlice() []foreignKey {
|
||||
return []foreignKey{}
|
||||
}
|
||||
|
||||
type gooseDBVersionUniques struct{}
|
||||
|
||||
func (u gooseDBVersionUniques) AsSlice() []constraint {
|
||||
return []constraint{}
|
||||
}
|
||||
|
||||
type gooseDBVersionChecks struct{}
|
||||
|
||||
func (c gooseDBVersionChecks) AsSlice() []check {
|
||||
return []check{}
|
||||
}
|
||||
102
dbinfo/organization.bob.go
Normal file
102
dbinfo/organization.bob.go
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
// Code generated by BobGen psql v0.41.1. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package dbinfo
|
||||
|
||||
import "github.com/aarondl/opt/null"
|
||||
|
||||
var Organizations = Table[
|
||||
organizationColumns,
|
||||
organizationIndexes,
|
||||
organizationForeignKeys,
|
||||
organizationUniques,
|
||||
organizationChecks,
|
||||
]{
|
||||
Schema: "",
|
||||
Name: "organization",
|
||||
Columns: organizationColumns{
|
||||
ID: column{
|
||||
Name: "id",
|
||||
DBType: "integer",
|
||||
Default: "nextval('organization_id_seq'::regclass)",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Name: column{
|
||||
Name: "name",
|
||||
DBType: "text",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
},
|
||||
Indexes: organizationIndexes{
|
||||
OrganizationPkey: index{
|
||||
Type: "btree",
|
||||
Name: "organization_pkey",
|
||||
Columns: []indexColumn{
|
||||
{
|
||||
Name: "id",
|
||||
Desc: null.FromCond(false, true),
|
||||
IsExpression: false,
|
||||
},
|
||||
},
|
||||
Unique: true,
|
||||
Comment: "",
|
||||
NullsFirst: []bool{false},
|
||||
NullsDistinct: false,
|
||||
Where: "",
|
||||
Include: []string{},
|
||||
},
|
||||
},
|
||||
PrimaryKey: &constraint{
|
||||
Name: "organization_pkey",
|
||||
Columns: []string{"id"},
|
||||
Comment: "",
|
||||
},
|
||||
|
||||
Comment: "",
|
||||
}
|
||||
|
||||
type organizationColumns struct {
|
||||
ID column
|
||||
Name column
|
||||
}
|
||||
|
||||
func (c organizationColumns) AsSlice() []column {
|
||||
return []column{
|
||||
c.ID, c.Name,
|
||||
}
|
||||
}
|
||||
|
||||
type organizationIndexes struct {
|
||||
OrganizationPkey index
|
||||
}
|
||||
|
||||
func (i organizationIndexes) AsSlice() []index {
|
||||
return []index{
|
||||
i.OrganizationPkey,
|
||||
}
|
||||
}
|
||||
|
||||
type organizationForeignKeys struct{}
|
||||
|
||||
func (f organizationForeignKeys) AsSlice() []foreignKey {
|
||||
return []foreignKey{}
|
||||
}
|
||||
|
||||
type organizationUniques struct{}
|
||||
|
||||
func (u organizationUniques) AsSlice() []constraint {
|
||||
return []constraint{}
|
||||
}
|
||||
|
||||
type organizationChecks struct{}
|
||||
|
||||
func (c organizationChecks) AsSlice() []check {
|
||||
return []check{}
|
||||
}
|
||||
197
dbinfo/user_.bob.go
Normal file
197
dbinfo/user_.bob.go
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
// Code generated by BobGen psql v0.41.1. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package dbinfo
|
||||
|
||||
import "github.com/aarondl/opt/null"
|
||||
|
||||
var Users = Table[
|
||||
userColumns,
|
||||
userIndexes,
|
||||
userForeignKeys,
|
||||
userUniques,
|
||||
userChecks,
|
||||
]{
|
||||
Schema: "",
|
||||
Name: "user_",
|
||||
Columns: userColumns{
|
||||
ID: column{
|
||||
Name: "id",
|
||||
DBType: "integer",
|
||||
Default: "nextval('user__id_seq'::regclass)",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
ArcgisAccessToken: column{
|
||||
Name: "arcgis_access_token",
|
||||
DBType: "text",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
ArcgisLicense: column{
|
||||
Name: "arcgis_license",
|
||||
DBType: "public.arcgis_license_type",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
ArcgisRefreshToken: column{
|
||||
Name: "arcgis_refresh_token",
|
||||
DBType: "text",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
ArcgisRefreshTokenExpires: column{
|
||||
Name: "arcgis_refresh_token_expires",
|
||||
DBType: "timestamp without time zone",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
ArcgisRole: column{
|
||||
Name: "arcgis_role",
|
||||
DBType: "text",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
DisplayName: column{
|
||||
Name: "display_name",
|
||||
DBType: "character varying",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Email: column{
|
||||
Name: "email",
|
||||
DBType: "text",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
OrganizationID: column{
|
||||
Name: "organization_id",
|
||||
DBType: "integer",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Username: column{
|
||||
Name: "username",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
},
|
||||
Indexes: userIndexes{
|
||||
UserPkey: index{
|
||||
Type: "btree",
|
||||
Name: "user__pkey",
|
||||
Columns: []indexColumn{
|
||||
{
|
||||
Name: "id",
|
||||
Desc: null.FromCond(false, true),
|
||||
IsExpression: false,
|
||||
},
|
||||
},
|
||||
Unique: true,
|
||||
Comment: "",
|
||||
NullsFirst: []bool{false},
|
||||
NullsDistinct: false,
|
||||
Where: "",
|
||||
Include: []string{},
|
||||
},
|
||||
},
|
||||
PrimaryKey: &constraint{
|
||||
Name: "user__pkey",
|
||||
Columns: []string{"id"},
|
||||
Comment: "",
|
||||
},
|
||||
ForeignKeys: userForeignKeys{
|
||||
UserUserOrganizationIDFkey: foreignKey{
|
||||
constraint: constraint{
|
||||
Name: "user_.user__organization_id_fkey",
|
||||
Columns: []string{"organization_id"},
|
||||
Comment: "",
|
||||
},
|
||||
ForeignTable: "organization",
|
||||
ForeignColumns: []string{"id"},
|
||||
},
|
||||
},
|
||||
|
||||
Comment: "",
|
||||
}
|
||||
|
||||
type userColumns struct {
|
||||
ID column
|
||||
ArcgisAccessToken column
|
||||
ArcgisLicense column
|
||||
ArcgisRefreshToken column
|
||||
ArcgisRefreshTokenExpires column
|
||||
ArcgisRole column
|
||||
DisplayName column
|
||||
Email column
|
||||
OrganizationID column
|
||||
Username column
|
||||
}
|
||||
|
||||
func (c userColumns) AsSlice() []column {
|
||||
return []column{
|
||||
c.ID, c.ArcgisAccessToken, c.ArcgisLicense, c.ArcgisRefreshToken, c.ArcgisRefreshTokenExpires, c.ArcgisRole, c.DisplayName, c.Email, c.OrganizationID, c.Username,
|
||||
}
|
||||
}
|
||||
|
||||
type userIndexes struct {
|
||||
UserPkey index
|
||||
}
|
||||
|
||||
func (i userIndexes) AsSlice() []index {
|
||||
return []index{
|
||||
i.UserPkey,
|
||||
}
|
||||
}
|
||||
|
||||
type userForeignKeys struct {
|
||||
UserUserOrganizationIDFkey foreignKey
|
||||
}
|
||||
|
||||
func (f userForeignKeys) AsSlice() []foreignKey {
|
||||
return []foreignKey{
|
||||
f.UserUserOrganizationIDFkey,
|
||||
}
|
||||
}
|
||||
|
||||
type userUniques struct{}
|
||||
|
||||
func (u userUniques) AsSlice() []constraint {
|
||||
return []constraint{}
|
||||
}
|
||||
|
||||
type userChecks struct{}
|
||||
|
||||
func (c userChecks) AsSlice() []check {
|
||||
return []check{}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue