710ab06333
Additive/expand-contract: new append-only retained_identities table (the legal dossier of every detached credential, keyed by account_id, TTL'd by detached_at) plus nullable accounts columns last_login_at/last_login_ip (cold-load stamp) and deleted_at/deleted_display_name (tombstone + retained real name). Regenerates the go-jet models for accounts + retained_identities only.
100 lines
3.5 KiB
Go
100 lines
3.5 KiB
Go
//
|
|
// Code generated by go-jet DO NOT EDIT.
|
|
//
|
|
// WARNING: Changes to this file may cause incorrect behavior
|
|
// and will be lost if the code is regenerated
|
|
//
|
|
|
|
package table
|
|
|
|
import (
|
|
"github.com/go-jet/jet/v2/postgres"
|
|
)
|
|
|
|
var RetainedIdentities = newRetainedIdentitiesTable("backend", "retained_identities", "")
|
|
|
|
type retainedIdentitiesTable struct {
|
|
postgres.Table
|
|
|
|
// Columns
|
|
RetainedID postgres.ColumnString
|
|
AccountID postgres.ColumnString
|
|
Kind postgres.ColumnString
|
|
ExternalID postgres.ColumnString
|
|
Confirmed postgres.ColumnBool
|
|
LinkedAt postgres.ColumnTimestampz
|
|
DetachedAt postgres.ColumnTimestampz
|
|
Reason postgres.ColumnString
|
|
|
|
AllColumns postgres.ColumnList
|
|
MutableColumns postgres.ColumnList
|
|
DefaultColumns postgres.ColumnList
|
|
}
|
|
|
|
type RetainedIdentitiesTable struct {
|
|
retainedIdentitiesTable
|
|
|
|
EXCLUDED retainedIdentitiesTable
|
|
}
|
|
|
|
// AS creates new RetainedIdentitiesTable with assigned alias
|
|
func (a RetainedIdentitiesTable) AS(alias string) *RetainedIdentitiesTable {
|
|
return newRetainedIdentitiesTable(a.SchemaName(), a.TableName(), alias)
|
|
}
|
|
|
|
// Schema creates new RetainedIdentitiesTable with assigned schema name
|
|
func (a RetainedIdentitiesTable) FromSchema(schemaName string) *RetainedIdentitiesTable {
|
|
return newRetainedIdentitiesTable(schemaName, a.TableName(), a.Alias())
|
|
}
|
|
|
|
// WithPrefix creates new RetainedIdentitiesTable with assigned table prefix
|
|
func (a RetainedIdentitiesTable) WithPrefix(prefix string) *RetainedIdentitiesTable {
|
|
return newRetainedIdentitiesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
|
}
|
|
|
|
// WithSuffix creates new RetainedIdentitiesTable with assigned table suffix
|
|
func (a RetainedIdentitiesTable) WithSuffix(suffix string) *RetainedIdentitiesTable {
|
|
return newRetainedIdentitiesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
|
}
|
|
|
|
func newRetainedIdentitiesTable(schemaName, tableName, alias string) *RetainedIdentitiesTable {
|
|
return &RetainedIdentitiesTable{
|
|
retainedIdentitiesTable: newRetainedIdentitiesTableImpl(schemaName, tableName, alias),
|
|
EXCLUDED: newRetainedIdentitiesTableImpl("", "excluded", ""),
|
|
}
|
|
}
|
|
|
|
func newRetainedIdentitiesTableImpl(schemaName, tableName, alias string) retainedIdentitiesTable {
|
|
var (
|
|
RetainedIDColumn = postgres.StringColumn("retained_id")
|
|
AccountIDColumn = postgres.StringColumn("account_id")
|
|
KindColumn = postgres.StringColumn("kind")
|
|
ExternalIDColumn = postgres.StringColumn("external_id")
|
|
ConfirmedColumn = postgres.BoolColumn("confirmed")
|
|
LinkedAtColumn = postgres.TimestampzColumn("linked_at")
|
|
DetachedAtColumn = postgres.TimestampzColumn("detached_at")
|
|
ReasonColumn = postgres.StringColumn("reason")
|
|
allColumns = postgres.ColumnList{RetainedIDColumn, AccountIDColumn, KindColumn, ExternalIDColumn, ConfirmedColumn, LinkedAtColumn, DetachedAtColumn, ReasonColumn}
|
|
mutableColumns = postgres.ColumnList{AccountIDColumn, KindColumn, ExternalIDColumn, ConfirmedColumn, LinkedAtColumn, DetachedAtColumn, ReasonColumn}
|
|
defaultColumns = postgres.ColumnList{ConfirmedColumn, DetachedAtColumn}
|
|
)
|
|
|
|
return retainedIdentitiesTable{
|
|
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
|
|
|
//Columns
|
|
RetainedID: RetainedIDColumn,
|
|
AccountID: AccountIDColumn,
|
|
Kind: KindColumn,
|
|
ExternalID: ExternalIDColumn,
|
|
Confirmed: ConfirmedColumn,
|
|
LinkedAt: LinkedAtColumn,
|
|
DetachedAt: DetachedAtColumn,
|
|
Reason: ReasonColumn,
|
|
|
|
AllColumns: allColumns,
|
|
MutableColumns: mutableColumns,
|
|
DefaultColumns: defaultColumns,
|
|
}
|
|
}
|