Update new storage types and regenerate
This commit is contained in:
parent
0932f19f71
commit
41e432b56e
28 changed files with 6561 additions and 23 deletions
668
storage-new/dbgen/access_tokens.gen.go
Normal file
668
storage-new/dbgen/access_tokens.gen.go
Normal file
|
@ -0,0 +1,668 @@
|
|||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package dbgen
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
)
|
||||
|
||||
func newAccessToken(db *gorm.DB, opts ...gen.DOOption) accessToken {
|
||||
_accessToken := accessToken{}
|
||||
|
||||
_accessToken.accessTokenDo.UseDB(db, opts...)
|
||||
_accessToken.accessTokenDo.UseModel(&models.AccessToken{})
|
||||
|
||||
tableName := _accessToken.accessTokenDo.TableName()
|
||||
_accessToken.ALL = field.NewAsterisk(tableName)
|
||||
_accessToken.UserId = field.NewString(tableName, "user_id")
|
||||
_accessToken.Token = field.NewString(tableName, "token")
|
||||
_accessToken.Name = field.NewString(tableName, "name")
|
||||
_accessToken.ExpiresAt = field.NewTime(tableName, "expires_at")
|
||||
_accessToken.User = accessTokenBelongsToUser{
|
||||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("User", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_accessToken.fillFieldMap()
|
||||
|
||||
return _accessToken
|
||||
}
|
||||
|
||||
type accessToken struct {
|
||||
accessTokenDo
|
||||
|
||||
ALL field.Asterisk
|
||||
UserId field.String
|
||||
Token field.String
|
||||
Name field.String
|
||||
ExpiresAt field.Time
|
||||
User accessTokenBelongsToUser
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (a accessToken) Table(newTableName string) *accessToken {
|
||||
a.accessTokenDo.UseTable(newTableName)
|
||||
return a.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (a accessToken) As(alias string) *accessToken {
|
||||
a.accessTokenDo.DO = *(a.accessTokenDo.As(alias).(*gen.DO))
|
||||
return a.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (a *accessToken) updateTableName(table string) *accessToken {
|
||||
a.ALL = field.NewAsterisk(table)
|
||||
a.UserId = field.NewString(table, "user_id")
|
||||
a.Token = field.NewString(table, "token")
|
||||
a.Name = field.NewString(table, "name")
|
||||
a.ExpiresAt = field.NewTime(table, "expires_at")
|
||||
|
||||
a.fillFieldMap()
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
func (a *accessToken) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := a.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (a *accessToken) fillFieldMap() {
|
||||
a.fieldMap = make(map[string]field.Expr, 5)
|
||||
a.fieldMap["user_id"] = a.UserId
|
||||
a.fieldMap["token"] = a.Token
|
||||
a.fieldMap["name"] = a.Name
|
||||
a.fieldMap["expires_at"] = a.ExpiresAt
|
||||
|
||||
}
|
||||
|
||||
func (a accessToken) clone(db *gorm.DB) accessToken {
|
||||
a.accessTokenDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return a
|
||||
}
|
||||
|
||||
func (a accessToken) replaceDB(db *gorm.DB) accessToken {
|
||||
a.accessTokenDo.ReplaceDB(db)
|
||||
return a
|
||||
}
|
||||
|
||||
type accessTokenBelongsToUser struct {
|
||||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a accessTokenBelongsToUser) Where(conds ...field.Expr) *accessTokenBelongsToUser {
|
||||
if len(conds) == 0 {
|
||||
return &a
|
||||
}
|
||||
|
||||
exprs := make([]clause.Expression, 0, len(conds))
|
||||
for _, cond := range conds {
|
||||
exprs = append(exprs, cond.BeCond().(clause.Expression))
|
||||
}
|
||||
a.db = a.db.Clauses(clause.Where{Exprs: exprs})
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a accessTokenBelongsToUser) WithContext(ctx context.Context) *accessTokenBelongsToUser {
|
||||
a.db = a.db.WithContext(ctx)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a accessTokenBelongsToUser) Session(session *gorm.Session) *accessTokenBelongsToUser {
|
||||
a.db = a.db.Session(session)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a accessTokenBelongsToUser) Model(m *models.AccessToken) *accessTokenBelongsToUserTx {
|
||||
return &accessTokenBelongsToUserTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
type accessTokenBelongsToUserTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a accessTokenBelongsToUserTx) Find() (result *models.User, err error) {
|
||||
return result, a.tx.Find(&result)
|
||||
}
|
||||
|
||||
func (a accessTokenBelongsToUserTx) Append(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Append(targetValues...)
|
||||
}
|
||||
|
||||
func (a accessTokenBelongsToUserTx) Replace(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Replace(targetValues...)
|
||||
}
|
||||
|
||||
func (a accessTokenBelongsToUserTx) Delete(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Delete(targetValues...)
|
||||
}
|
||||
|
||||
func (a accessTokenBelongsToUserTx) Clear() error {
|
||||
return a.tx.Clear()
|
||||
}
|
||||
|
||||
func (a accessTokenBelongsToUserTx) Count() int64 {
|
||||
return a.tx.Count()
|
||||
}
|
||||
|
||||
type accessTokenDo struct{ gen.DO }
|
||||
|
||||
type IAccessTokenDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IAccessTokenDo
|
||||
WithContext(ctx context.Context) IAccessTokenDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IAccessTokenDo
|
||||
WriteDB() IAccessTokenDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IAccessTokenDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IAccessTokenDo
|
||||
Not(conds ...gen.Condition) IAccessTokenDo
|
||||
Or(conds ...gen.Condition) IAccessTokenDo
|
||||
Select(conds ...field.Expr) IAccessTokenDo
|
||||
Where(conds ...gen.Condition) IAccessTokenDo
|
||||
Order(conds ...field.Expr) IAccessTokenDo
|
||||
Distinct(cols ...field.Expr) IAccessTokenDo
|
||||
Omit(cols ...field.Expr) IAccessTokenDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IAccessTokenDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IAccessTokenDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IAccessTokenDo
|
||||
Group(cols ...field.Expr) IAccessTokenDo
|
||||
Having(conds ...gen.Condition) IAccessTokenDo
|
||||
Limit(limit int) IAccessTokenDo
|
||||
Offset(offset int) IAccessTokenDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IAccessTokenDo
|
||||
Unscoped() IAccessTokenDo
|
||||
Create(values ...*models.AccessToken) error
|
||||
CreateInBatches(values []*models.AccessToken, batchSize int) error
|
||||
Save(values ...*models.AccessToken) error
|
||||
First() (*models.AccessToken, error)
|
||||
Take() (*models.AccessToken, error)
|
||||
Last() (*models.AccessToken, error)
|
||||
Find() ([]*models.AccessToken, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.AccessToken, err error)
|
||||
FindInBatches(result *[]*models.AccessToken, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*models.AccessToken) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IAccessTokenDo
|
||||
Assign(attrs ...field.AssignExpr) IAccessTokenDo
|
||||
Joins(fields ...field.RelationField) IAccessTokenDo
|
||||
Preload(fields ...field.RelationField) IAccessTokenDo
|
||||
FirstOrInit() (*models.AccessToken, error)
|
||||
FirstOrCreate() (*models.AccessToken, error)
|
||||
FindByPage(offset int, limit int) (result []*models.AccessToken, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IAccessTokenDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Debug() IAccessTokenDo {
|
||||
return a.withDO(a.DO.Debug())
|
||||
}
|
||||
|
||||
func (a accessTokenDo) WithContext(ctx context.Context) IAccessTokenDo {
|
||||
return a.withDO(a.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) ReadDB() IAccessTokenDo {
|
||||
return a.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (a accessTokenDo) WriteDB() IAccessTokenDo {
|
||||
return a.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Session(config *gorm.Session) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Session(config))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Clauses(conds ...clause.Expression) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Returning(value interface{}, columns ...string) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Not(conds ...gen.Condition) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Or(conds ...gen.Condition) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Select(conds ...field.Expr) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Where(conds ...gen.Condition) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Order(conds ...field.Expr) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Distinct(cols ...field.Expr) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Omit(cols ...field.Expr) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Join(table schema.Tabler, on ...field.Expr) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) LeftJoin(table schema.Tabler, on ...field.Expr) IAccessTokenDo {
|
||||
return a.withDO(a.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) RightJoin(table schema.Tabler, on ...field.Expr) IAccessTokenDo {
|
||||
return a.withDO(a.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Group(cols ...field.Expr) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Having(conds ...gen.Condition) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Limit(limit int) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Offset(offset int) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Unscoped() IAccessTokenDo {
|
||||
return a.withDO(a.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Create(values ...*models.AccessToken) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return a.DO.Create(values)
|
||||
}
|
||||
|
||||
func (a accessTokenDo) CreateInBatches(values []*models.AccessToken, batchSize int) error {
|
||||
return a.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (a accessTokenDo) Save(values ...*models.AccessToken) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return a.DO.Save(values)
|
||||
}
|
||||
|
||||
func (a accessTokenDo) First() (*models.AccessToken, error) {
|
||||
if result, err := a.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.AccessToken), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Take() (*models.AccessToken, error) {
|
||||
if result, err := a.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.AccessToken), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Last() (*models.AccessToken, error) {
|
||||
if result, err := a.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.AccessToken), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Find() ([]*models.AccessToken, error) {
|
||||
result, err := a.DO.Find()
|
||||
return result.([]*models.AccessToken), err
|
||||
}
|
||||
|
||||
func (a accessTokenDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.AccessToken, err error) {
|
||||
buf := make([]*models.AccessToken, 0, batchSize)
|
||||
err = a.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (a accessTokenDo) FindInBatches(result *[]*models.AccessToken, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return a.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Attrs(attrs ...field.AssignExpr) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Assign(attrs ...field.AssignExpr) IAccessTokenDo {
|
||||
return a.withDO(a.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Joins(fields ...field.RelationField) IAccessTokenDo {
|
||||
for _, _f := range fields {
|
||||
a = *a.withDO(a.DO.Joins(_f))
|
||||
}
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Preload(fields ...field.RelationField) IAccessTokenDo {
|
||||
for _, _f := range fields {
|
||||
a = *a.withDO(a.DO.Preload(_f))
|
||||
}
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a accessTokenDo) FirstOrInit() (*models.AccessToken, error) {
|
||||
if result, err := a.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.AccessToken), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a accessTokenDo) FirstOrCreate() (*models.AccessToken, error) {
|
||||
if result, err := a.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.AccessToken), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a accessTokenDo) FindByPage(offset int, limit int) (result []*models.AccessToken, count int64, err error) {
|
||||
result, err = a.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = a.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (a accessTokenDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = a.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = a.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Scan(result interface{}) (err error) {
|
||||
return a.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (a accessTokenDo) Delete(models ...*models.AccessToken) (result gen.ResultInfo, err error) {
|
||||
return a.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (a *accessTokenDo) withDO(do gen.Dao) *accessTokenDo {
|
||||
a.DO = *do.(*gen.DO)
|
||||
return a
|
||||
}
|
|
@ -43,6 +43,11 @@ func newEmote(db *gorm.DB, opts ...gen.DOOption) emote {
|
|||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("Server", "models.RemoteServer"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Server.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
}
|
||||
|
||||
_emote.fillFieldMap()
|
||||
|
@ -199,6 +204,10 @@ type emoteBelongsToServer struct {
|
|||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
|
||||
func (a emoteBelongsToServer) Where(conds ...field.Expr) *emoteBelongsToServer {
|
||||
|
|
|
@ -17,7 +17,9 @@ import (
|
|||
|
||||
var (
|
||||
Q = new(Query)
|
||||
AccessToken *accessToken
|
||||
Emote *emote
|
||||
LoginProcessToken *loginProcessToken
|
||||
MediaMetadata *mediaMetadata
|
||||
Note *note
|
||||
NoteTag *noteTag
|
||||
|
@ -32,6 +34,7 @@ var (
|
|||
UserInfoField *userInfoField
|
||||
UserRemoteLinks *userRemoteLinks
|
||||
UserToBeing *userToBeing
|
||||
UserToPronoun *userToPronoun
|
||||
UserToRole *userToRole
|
||||
UserToTag *userToTag
|
||||
UserToUserRelation *userToUserRelation
|
||||
|
@ -39,7 +42,9 @@ var (
|
|||
|
||||
func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
||||
*Q = *Use(db, opts...)
|
||||
AccessToken = &Q.AccessToken
|
||||
Emote = &Q.Emote
|
||||
LoginProcessToken = &Q.LoginProcessToken
|
||||
MediaMetadata = &Q.MediaMetadata
|
||||
Note = &Q.Note
|
||||
NoteTag = &Q.NoteTag
|
||||
|
@ -54,6 +59,7 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
|||
UserInfoField = &Q.UserInfoField
|
||||
UserRemoteLinks = &Q.UserRemoteLinks
|
||||
UserToBeing = &Q.UserToBeing
|
||||
UserToPronoun = &Q.UserToPronoun
|
||||
UserToRole = &Q.UserToRole
|
||||
UserToTag = &Q.UserToTag
|
||||
UserToUserRelation = &Q.UserToUserRelation
|
||||
|
@ -62,7 +68,9 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
|||
func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
AccessToken: newAccessToken(db, opts...),
|
||||
Emote: newEmote(db, opts...),
|
||||
LoginProcessToken: newLoginProcessToken(db, opts...),
|
||||
MediaMetadata: newMediaMetadata(db, opts...),
|
||||
Note: newNote(db, opts...),
|
||||
NoteTag: newNoteTag(db, opts...),
|
||||
|
@ -77,6 +85,7 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
|||
UserInfoField: newUserInfoField(db, opts...),
|
||||
UserRemoteLinks: newUserRemoteLinks(db, opts...),
|
||||
UserToBeing: newUserToBeing(db, opts...),
|
||||
UserToPronoun: newUserToPronoun(db, opts...),
|
||||
UserToRole: newUserToRole(db, opts...),
|
||||
UserToTag: newUserToTag(db, opts...),
|
||||
UserToUserRelation: newUserToUserRelation(db, opts...),
|
||||
|
@ -86,7 +95,9 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
|||
type Query struct {
|
||||
db *gorm.DB
|
||||
|
||||
AccessToken accessToken
|
||||
Emote emote
|
||||
LoginProcessToken loginProcessToken
|
||||
MediaMetadata mediaMetadata
|
||||
Note note
|
||||
NoteTag noteTag
|
||||
|
@ -101,6 +112,7 @@ type Query struct {
|
|||
UserInfoField userInfoField
|
||||
UserRemoteLinks userRemoteLinks
|
||||
UserToBeing userToBeing
|
||||
UserToPronoun userToPronoun
|
||||
UserToRole userToRole
|
||||
UserToTag userToTag
|
||||
UserToUserRelation userToUserRelation
|
||||
|
@ -111,7 +123,9 @@ func (q *Query) Available() bool { return q.db != nil }
|
|||
func (q *Query) clone(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
AccessToken: q.AccessToken.clone(db),
|
||||
Emote: q.Emote.clone(db),
|
||||
LoginProcessToken: q.LoginProcessToken.clone(db),
|
||||
MediaMetadata: q.MediaMetadata.clone(db),
|
||||
Note: q.Note.clone(db),
|
||||
NoteTag: q.NoteTag.clone(db),
|
||||
|
@ -126,6 +140,7 @@ func (q *Query) clone(db *gorm.DB) *Query {
|
|||
UserInfoField: q.UserInfoField.clone(db),
|
||||
UserRemoteLinks: q.UserRemoteLinks.clone(db),
|
||||
UserToBeing: q.UserToBeing.clone(db),
|
||||
UserToPronoun: q.UserToPronoun.clone(db),
|
||||
UserToRole: q.UserToRole.clone(db),
|
||||
UserToTag: q.UserToTag.clone(db),
|
||||
UserToUserRelation: q.UserToUserRelation.clone(db),
|
||||
|
@ -143,7 +158,9 @@ func (q *Query) WriteDB() *Query {
|
|||
func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
AccessToken: q.AccessToken.replaceDB(db),
|
||||
Emote: q.Emote.replaceDB(db),
|
||||
LoginProcessToken: q.LoginProcessToken.replaceDB(db),
|
||||
MediaMetadata: q.MediaMetadata.replaceDB(db),
|
||||
Note: q.Note.replaceDB(db),
|
||||
NoteTag: q.NoteTag.replaceDB(db),
|
||||
|
@ -158,6 +175,7 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
|||
UserInfoField: q.UserInfoField.replaceDB(db),
|
||||
UserRemoteLinks: q.UserRemoteLinks.replaceDB(db),
|
||||
UserToBeing: q.UserToBeing.replaceDB(db),
|
||||
UserToPronoun: q.UserToPronoun.replaceDB(db),
|
||||
UserToRole: q.UserToRole.replaceDB(db),
|
||||
UserToTag: q.UserToTag.replaceDB(db),
|
||||
UserToUserRelation: q.UserToUserRelation.replaceDB(db),
|
||||
|
@ -165,7 +183,9 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
|||
}
|
||||
|
||||
type queryCtx struct {
|
||||
AccessToken IAccessTokenDo
|
||||
Emote IEmoteDo
|
||||
LoginProcessToken ILoginProcessTokenDo
|
||||
MediaMetadata IMediaMetadataDo
|
||||
Note INoteDo
|
||||
NoteTag INoteTagDo
|
||||
|
@ -180,6 +200,7 @@ type queryCtx struct {
|
|||
UserInfoField IUserInfoFieldDo
|
||||
UserRemoteLinks IUserRemoteLinksDo
|
||||
UserToBeing IUserToBeingDo
|
||||
UserToPronoun IUserToPronounDo
|
||||
UserToRole IUserToRoleDo
|
||||
UserToTag IUserToTagDo
|
||||
UserToUserRelation IUserToUserRelationDo
|
||||
|
@ -187,7 +208,9 @@ type queryCtx struct {
|
|||
|
||||
func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||
return &queryCtx{
|
||||
AccessToken: q.AccessToken.WithContext(ctx),
|
||||
Emote: q.Emote.WithContext(ctx),
|
||||
LoginProcessToken: q.LoginProcessToken.WithContext(ctx),
|
||||
MediaMetadata: q.MediaMetadata.WithContext(ctx),
|
||||
Note: q.Note.WithContext(ctx),
|
||||
NoteTag: q.NoteTag.WithContext(ctx),
|
||||
|
@ -202,6 +225,7 @@ func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
|||
UserInfoField: q.UserInfoField.WithContext(ctx),
|
||||
UserRemoteLinks: q.UserRemoteLinks.WithContext(ctx),
|
||||
UserToBeing: q.UserToBeing.WithContext(ctx),
|
||||
UserToPronoun: q.UserToPronoun.WithContext(ctx),
|
||||
UserToRole: q.UserToRole.WithContext(ctx),
|
||||
UserToTag: q.UserToTag.WithContext(ctx),
|
||||
UserToUserRelation: q.UserToUserRelation.WithContext(ctx),
|
||||
|
|
660
storage-new/dbgen/login_process_tokens.gen.go
Normal file
660
storage-new/dbgen/login_process_tokens.gen.go
Normal file
|
@ -0,0 +1,660 @@
|
|||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package dbgen
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
)
|
||||
|
||||
func newLoginProcessToken(db *gorm.DB, opts ...gen.DOOption) loginProcessToken {
|
||||
_loginProcessToken := loginProcessToken{}
|
||||
|
||||
_loginProcessToken.loginProcessTokenDo.UseDB(db, opts...)
|
||||
_loginProcessToken.loginProcessTokenDo.UseModel(&models.LoginProcessToken{})
|
||||
|
||||
tableName := _loginProcessToken.loginProcessTokenDo.TableName()
|
||||
_loginProcessToken.ALL = field.NewAsterisk(tableName)
|
||||
_loginProcessToken.UserId = field.NewString(tableName, "user_id")
|
||||
_loginProcessToken.Token = field.NewString(tableName, "token")
|
||||
_loginProcessToken.User = loginProcessTokenBelongsToUser{
|
||||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("User", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_loginProcessToken.fillFieldMap()
|
||||
|
||||
return _loginProcessToken
|
||||
}
|
||||
|
||||
type loginProcessToken struct {
|
||||
loginProcessTokenDo
|
||||
|
||||
ALL field.Asterisk
|
||||
UserId field.String
|
||||
Token field.String
|
||||
User loginProcessTokenBelongsToUser
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (l loginProcessToken) Table(newTableName string) *loginProcessToken {
|
||||
l.loginProcessTokenDo.UseTable(newTableName)
|
||||
return l.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (l loginProcessToken) As(alias string) *loginProcessToken {
|
||||
l.loginProcessTokenDo.DO = *(l.loginProcessTokenDo.As(alias).(*gen.DO))
|
||||
return l.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (l *loginProcessToken) updateTableName(table string) *loginProcessToken {
|
||||
l.ALL = field.NewAsterisk(table)
|
||||
l.UserId = field.NewString(table, "user_id")
|
||||
l.Token = field.NewString(table, "token")
|
||||
|
||||
l.fillFieldMap()
|
||||
|
||||
return l
|
||||
}
|
||||
|
||||
func (l *loginProcessToken) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := l.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (l *loginProcessToken) fillFieldMap() {
|
||||
l.fieldMap = make(map[string]field.Expr, 3)
|
||||
l.fieldMap["user_id"] = l.UserId
|
||||
l.fieldMap["token"] = l.Token
|
||||
|
||||
}
|
||||
|
||||
func (l loginProcessToken) clone(db *gorm.DB) loginProcessToken {
|
||||
l.loginProcessTokenDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return l
|
||||
}
|
||||
|
||||
func (l loginProcessToken) replaceDB(db *gorm.DB) loginProcessToken {
|
||||
l.loginProcessTokenDo.ReplaceDB(db)
|
||||
return l
|
||||
}
|
||||
|
||||
type loginProcessTokenBelongsToUser struct {
|
||||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a loginProcessTokenBelongsToUser) Where(conds ...field.Expr) *loginProcessTokenBelongsToUser {
|
||||
if len(conds) == 0 {
|
||||
return &a
|
||||
}
|
||||
|
||||
exprs := make([]clause.Expression, 0, len(conds))
|
||||
for _, cond := range conds {
|
||||
exprs = append(exprs, cond.BeCond().(clause.Expression))
|
||||
}
|
||||
a.db = a.db.Clauses(clause.Where{Exprs: exprs})
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a loginProcessTokenBelongsToUser) WithContext(ctx context.Context) *loginProcessTokenBelongsToUser {
|
||||
a.db = a.db.WithContext(ctx)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a loginProcessTokenBelongsToUser) Session(session *gorm.Session) *loginProcessTokenBelongsToUser {
|
||||
a.db = a.db.Session(session)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a loginProcessTokenBelongsToUser) Model(m *models.LoginProcessToken) *loginProcessTokenBelongsToUserTx {
|
||||
return &loginProcessTokenBelongsToUserTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
type loginProcessTokenBelongsToUserTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a loginProcessTokenBelongsToUserTx) Find() (result *models.User, err error) {
|
||||
return result, a.tx.Find(&result)
|
||||
}
|
||||
|
||||
func (a loginProcessTokenBelongsToUserTx) Append(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Append(targetValues...)
|
||||
}
|
||||
|
||||
func (a loginProcessTokenBelongsToUserTx) Replace(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Replace(targetValues...)
|
||||
}
|
||||
|
||||
func (a loginProcessTokenBelongsToUserTx) Delete(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Delete(targetValues...)
|
||||
}
|
||||
|
||||
func (a loginProcessTokenBelongsToUserTx) Clear() error {
|
||||
return a.tx.Clear()
|
||||
}
|
||||
|
||||
func (a loginProcessTokenBelongsToUserTx) Count() int64 {
|
||||
return a.tx.Count()
|
||||
}
|
||||
|
||||
type loginProcessTokenDo struct{ gen.DO }
|
||||
|
||||
type ILoginProcessTokenDo interface {
|
||||
gen.SubQuery
|
||||
Debug() ILoginProcessTokenDo
|
||||
WithContext(ctx context.Context) ILoginProcessTokenDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() ILoginProcessTokenDo
|
||||
WriteDB() ILoginProcessTokenDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) ILoginProcessTokenDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) ILoginProcessTokenDo
|
||||
Not(conds ...gen.Condition) ILoginProcessTokenDo
|
||||
Or(conds ...gen.Condition) ILoginProcessTokenDo
|
||||
Select(conds ...field.Expr) ILoginProcessTokenDo
|
||||
Where(conds ...gen.Condition) ILoginProcessTokenDo
|
||||
Order(conds ...field.Expr) ILoginProcessTokenDo
|
||||
Distinct(cols ...field.Expr) ILoginProcessTokenDo
|
||||
Omit(cols ...field.Expr) ILoginProcessTokenDo
|
||||
Join(table schema.Tabler, on ...field.Expr) ILoginProcessTokenDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) ILoginProcessTokenDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) ILoginProcessTokenDo
|
||||
Group(cols ...field.Expr) ILoginProcessTokenDo
|
||||
Having(conds ...gen.Condition) ILoginProcessTokenDo
|
||||
Limit(limit int) ILoginProcessTokenDo
|
||||
Offset(offset int) ILoginProcessTokenDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) ILoginProcessTokenDo
|
||||
Unscoped() ILoginProcessTokenDo
|
||||
Create(values ...*models.LoginProcessToken) error
|
||||
CreateInBatches(values []*models.LoginProcessToken, batchSize int) error
|
||||
Save(values ...*models.LoginProcessToken) error
|
||||
First() (*models.LoginProcessToken, error)
|
||||
Take() (*models.LoginProcessToken, error)
|
||||
Last() (*models.LoginProcessToken, error)
|
||||
Find() ([]*models.LoginProcessToken, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.LoginProcessToken, err error)
|
||||
FindInBatches(result *[]*models.LoginProcessToken, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*models.LoginProcessToken) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) ILoginProcessTokenDo
|
||||
Assign(attrs ...field.AssignExpr) ILoginProcessTokenDo
|
||||
Joins(fields ...field.RelationField) ILoginProcessTokenDo
|
||||
Preload(fields ...field.RelationField) ILoginProcessTokenDo
|
||||
FirstOrInit() (*models.LoginProcessToken, error)
|
||||
FirstOrCreate() (*models.LoginProcessToken, error)
|
||||
FindByPage(offset int, limit int) (result []*models.LoginProcessToken, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) ILoginProcessTokenDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Debug() ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Debug())
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) WithContext(ctx context.Context) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) ReadDB() ILoginProcessTokenDo {
|
||||
return l.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) WriteDB() ILoginProcessTokenDo {
|
||||
return l.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Session(config *gorm.Session) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Session(config))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Clauses(conds ...clause.Expression) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Returning(value interface{}, columns ...string) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Not(conds ...gen.Condition) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Or(conds ...gen.Condition) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Select(conds ...field.Expr) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Where(conds ...gen.Condition) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Order(conds ...field.Expr) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Distinct(cols ...field.Expr) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Omit(cols ...field.Expr) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Join(table schema.Tabler, on ...field.Expr) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) LeftJoin(table schema.Tabler, on ...field.Expr) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) RightJoin(table schema.Tabler, on ...field.Expr) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Group(cols ...field.Expr) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Having(conds ...gen.Condition) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Limit(limit int) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Offset(offset int) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Unscoped() ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Create(values ...*models.LoginProcessToken) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return l.DO.Create(values)
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) CreateInBatches(values []*models.LoginProcessToken, batchSize int) error {
|
||||
return l.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (l loginProcessTokenDo) Save(values ...*models.LoginProcessToken) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return l.DO.Save(values)
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) First() (*models.LoginProcessToken, error) {
|
||||
if result, err := l.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.LoginProcessToken), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Take() (*models.LoginProcessToken, error) {
|
||||
if result, err := l.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.LoginProcessToken), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Last() (*models.LoginProcessToken, error) {
|
||||
if result, err := l.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.LoginProcessToken), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Find() ([]*models.LoginProcessToken, error) {
|
||||
result, err := l.DO.Find()
|
||||
return result.([]*models.LoginProcessToken), err
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.LoginProcessToken, err error) {
|
||||
buf := make([]*models.LoginProcessToken, 0, batchSize)
|
||||
err = l.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) FindInBatches(result *[]*models.LoginProcessToken, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return l.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Attrs(attrs ...field.AssignExpr) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Assign(attrs ...field.AssignExpr) ILoginProcessTokenDo {
|
||||
return l.withDO(l.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Joins(fields ...field.RelationField) ILoginProcessTokenDo {
|
||||
for _, _f := range fields {
|
||||
l = *l.withDO(l.DO.Joins(_f))
|
||||
}
|
||||
return &l
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Preload(fields ...field.RelationField) ILoginProcessTokenDo {
|
||||
for _, _f := range fields {
|
||||
l = *l.withDO(l.DO.Preload(_f))
|
||||
}
|
||||
return &l
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) FirstOrInit() (*models.LoginProcessToken, error) {
|
||||
if result, err := l.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.LoginProcessToken), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) FirstOrCreate() (*models.LoginProcessToken, error) {
|
||||
if result, err := l.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.LoginProcessToken), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) FindByPage(offset int, limit int) (result []*models.LoginProcessToken, count int64, err error) {
|
||||
result, err = l.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = l.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = l.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = l.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Scan(result interface{}) (err error) {
|
||||
return l.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (l loginProcessTokenDo) Delete(models ...*models.LoginProcessToken) (result gen.ResultInfo, err error) {
|
||||
return l.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (l *loginProcessTokenDo) withDO(do gen.Dao) *loginProcessTokenDo {
|
||||
l.DO = *do.(*gen.DO)
|
||||
return l
|
||||
}
|
|
@ -32,6 +32,209 @@ func newNoteTag(db *gorm.DB, opts ...gen.DOOption) noteTag {
|
|||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("Note", "models.Note"),
|
||||
Creator: struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -65,6 +268,9 @@ func newNoteTag(db *gorm.DB, opts ...gen.DOOption) noteTag {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}{
|
||||
|
@ -81,6 +287,9 @@ func newNoteTag(db *gorm.DB, opts ...gen.DOOption) noteTag {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
||||
|
@ -91,8 +300,16 @@ func newNoteTag(db *gorm.DB, opts ...gen.DOOption) noteTag {
|
|||
},
|
||||
Server: struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -199,6 +416,72 @@ type noteTagBelongsToNote struct {
|
|||
|
||||
field.RelationField
|
||||
|
||||
Creator struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -220,6 +503,9 @@ type noteTagBelongsToNote struct {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,209 @@ func newNoteToAttachment(db *gorm.DB, opts ...gen.DOOption) noteToAttachment {
|
|||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("Note", "models.Note"),
|
||||
Creator: struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -65,6 +268,9 @@ func newNoteToAttachment(db *gorm.DB, opts ...gen.DOOption) noteToAttachment {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}{
|
||||
|
@ -81,6 +287,9 @@ func newNoteToAttachment(db *gorm.DB, opts ...gen.DOOption) noteToAttachment {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
||||
|
@ -91,8 +300,16 @@ func newNoteToAttachment(db *gorm.DB, opts ...gen.DOOption) noteToAttachment {
|
|||
},
|
||||
Server: struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -207,6 +424,72 @@ type noteToAttachmentBelongsToNote struct {
|
|||
|
||||
field.RelationField
|
||||
|
||||
Creator struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -228,6 +511,9 @@ type noteToAttachmentBelongsToNote struct {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,209 @@ func newNoteToEmote(db *gorm.DB, opts ...gen.DOOption) noteToEmote {
|
|||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("Note", "models.Note"),
|
||||
Creator: struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -65,6 +268,9 @@ func newNoteToEmote(db *gorm.DB, opts ...gen.DOOption) noteToEmote {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}{
|
||||
|
@ -81,6 +287,9 @@ func newNoteToEmote(db *gorm.DB, opts ...gen.DOOption) noteToEmote {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
||||
|
@ -91,8 +300,16 @@ func newNoteToEmote(db *gorm.DB, opts ...gen.DOOption) noteToEmote {
|
|||
},
|
||||
Server: struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -207,6 +424,72 @@ type noteToEmoteBelongsToNote struct {
|
|||
|
||||
field.RelationField
|
||||
|
||||
Creator struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -228,6 +511,9 @@ type noteToEmoteBelongsToNote struct {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,209 @@ func newNoteToPing(db *gorm.DB, opts ...gen.DOOption) noteToPing {
|
|||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("Note", "models.Note"),
|
||||
Creator: struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -65,6 +268,9 @@ func newNoteToPing(db *gorm.DB, opts ...gen.DOOption) noteToPing {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}{
|
||||
|
@ -81,6 +287,9 @@ func newNoteToPing(db *gorm.DB, opts ...gen.DOOption) noteToPing {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
||||
|
@ -91,8 +300,16 @@ func newNoteToPing(db *gorm.DB, opts ...gen.DOOption) noteToPing {
|
|||
},
|
||||
Server: struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -207,6 +424,72 @@ type noteToPingBelongsToNote struct {
|
|||
|
||||
field.RelationField
|
||||
|
||||
Creator struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -228,6 +511,9 @@ type noteToPingBelongsToNote struct {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,72 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
RelationField: field.NewRelation("AttachmentRelations", "models.NoteToAttachment"),
|
||||
Note: struct {
|
||||
field.RelationField
|
||||
Creator struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
}
|
||||
|
@ -59,6 +125,9 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +148,209 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note", "models.Note"),
|
||||
Creator: struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Creator.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
|
@ -96,6 +368,9 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}{
|
||||
|
@ -112,6 +387,9 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.EmoteRelations.Emote", "models.Emote"),
|
||||
|
@ -122,8 +400,16 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
},
|
||||
Server: struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.EmoteRelations.Emote.Server.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -187,6 +473,12 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
RelationField: field.NewRelation("Tags", "models.NoteTag"),
|
||||
}
|
||||
|
||||
_note.Creator = noteBelongsToCreator{
|
||||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("Creator", "models.User"),
|
||||
}
|
||||
|
||||
_note.fillFieldMap()
|
||||
|
||||
return _note
|
||||
|
@ -216,6 +508,8 @@ type note struct {
|
|||
|
||||
Tags noteHasManyTags
|
||||
|
||||
Creator noteBelongsToCreator
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
|
@ -259,7 +553,7 @@ func (n *note) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|||
}
|
||||
|
||||
func (n *note) fillFieldMap() {
|
||||
n.fieldMap = make(map[string]field.Expr, 16)
|
||||
n.fieldMap = make(map[string]field.Expr, 17)
|
||||
n.fieldMap["id"] = n.ID
|
||||
n.fieldMap["created_at"] = n.CreatedAt
|
||||
n.fieldMap["updated_at"] = n.UpdatedAt
|
||||
|
@ -292,6 +586,72 @@ type noteHasManyAttachmentRelations struct {
|
|||
|
||||
Note struct {
|
||||
field.RelationField
|
||||
Creator struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
}
|
||||
|
@ -307,6 +667,9 @@ type noteHasManyAttachmentRelations struct {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -609,6 +972,77 @@ func (a noteHasManyTagsTx) Count() int64 {
|
|||
return a.tx.Count()
|
||||
}
|
||||
|
||||
type noteBelongsToCreator struct {
|
||||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreator) Where(conds ...field.Expr) *noteBelongsToCreator {
|
||||
if len(conds) == 0 {
|
||||
return &a
|
||||
}
|
||||
|
||||
exprs := make([]clause.Expression, 0, len(conds))
|
||||
for _, cond := range conds {
|
||||
exprs = append(exprs, cond.BeCond().(clause.Expression))
|
||||
}
|
||||
a.db = a.db.Clauses(clause.Where{Exprs: exprs})
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreator) WithContext(ctx context.Context) *noteBelongsToCreator {
|
||||
a.db = a.db.WithContext(ctx)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreator) Session(session *gorm.Session) *noteBelongsToCreator {
|
||||
a.db = a.db.Session(session)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreator) Model(m *models.Note) *noteBelongsToCreatorTx {
|
||||
return ¬eBelongsToCreatorTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
type noteBelongsToCreatorTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a noteBelongsToCreatorTx) Find() (result *models.User, err error) {
|
||||
return result, a.tx.Find(&result)
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreatorTx) Append(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Append(targetValues...)
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreatorTx) Replace(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Replace(targetValues...)
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreatorTx) Delete(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Delete(targetValues...)
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreatorTx) Clear() error {
|
||||
return a.tx.Clear()
|
||||
}
|
||||
|
||||
func (a noteBelongsToCreatorTx) Count() int64 {
|
||||
return a.tx.Count()
|
||||
}
|
||||
|
||||
type noteDo struct{ gen.DO }
|
||||
|
||||
type INoteDo interface {
|
||||
|
|
|
@ -37,6 +37,209 @@ func newReaction(db *gorm.DB, opts ...gen.DOOption) reaction {
|
|||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("Note", "models.Note"),
|
||||
Creator: struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -70,6 +273,9 @@ func newReaction(db *gorm.DB, opts ...gen.DOOption) reaction {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}{
|
||||
|
@ -86,6 +292,9 @@ func newReaction(db *gorm.DB, opts ...gen.DOOption) reaction {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
||||
|
@ -96,8 +305,16 @@ func newReaction(db *gorm.DB, opts ...gen.DOOption) reaction {
|
|||
},
|
||||
Server: struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -235,6 +452,72 @@ type reactionBelongsToNote struct {
|
|||
|
||||
field.RelationField
|
||||
|
||||
Creator struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -256,6 +539,9 @@ type reactionBelongsToNote struct {
|
|||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,8 +33,13 @@ func newRemoteServer(db *gorm.DB, opts ...gen.DOOption) remoteServer {
|
|||
_remoteServer.ServerType = field.NewField(tableName, "server_type")
|
||||
_remoteServer.Domain = field.NewString(tableName, "domain")
|
||||
_remoteServer.Name = field.NewString(tableName, "name")
|
||||
_remoteServer.Icon = field.NewString(tableName, "icon")
|
||||
_remoteServer.IconId = field.NewString(tableName, "icon_id")
|
||||
_remoteServer.IsSelf = field.NewBool(tableName, "is_self")
|
||||
_remoteServer.Icon = remoteServerBelongsToIcon{
|
||||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("Icon", "models.MediaMetadata"),
|
||||
}
|
||||
|
||||
_remoteServer.fillFieldMap()
|
||||
|
||||
|
@ -52,8 +57,9 @@ type remoteServer struct {
|
|||
ServerType field.Field
|
||||
Domain field.String
|
||||
Name field.String
|
||||
Icon field.String
|
||||
IconId field.String
|
||||
IsSelf field.Bool
|
||||
Icon remoteServerBelongsToIcon
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
@ -77,7 +83,7 @@ func (r *remoteServer) updateTableName(table string) *remoteServer {
|
|||
r.ServerType = field.NewField(table, "server_type")
|
||||
r.Domain = field.NewString(table, "domain")
|
||||
r.Name = field.NewString(table, "name")
|
||||
r.Icon = field.NewString(table, "icon")
|
||||
r.IconId = field.NewString(table, "icon_id")
|
||||
r.IsSelf = field.NewBool(table, "is_self")
|
||||
|
||||
r.fillFieldMap()
|
||||
|
@ -95,7 +101,7 @@ func (r *remoteServer) GetFieldByName(fieldName string) (field.OrderExpr, bool)
|
|||
}
|
||||
|
||||
func (r *remoteServer) fillFieldMap() {
|
||||
r.fieldMap = make(map[string]field.Expr, 9)
|
||||
r.fieldMap = make(map[string]field.Expr, 10)
|
||||
r.fieldMap["id"] = r.ID
|
||||
r.fieldMap["created_at"] = r.CreatedAt
|
||||
r.fieldMap["updated_at"] = r.UpdatedAt
|
||||
|
@ -103,8 +109,9 @@ func (r *remoteServer) fillFieldMap() {
|
|||
r.fieldMap["server_type"] = r.ServerType
|
||||
r.fieldMap["domain"] = r.Domain
|
||||
r.fieldMap["name"] = r.Name
|
||||
r.fieldMap["icon"] = r.Icon
|
||||
r.fieldMap["icon_id"] = r.IconId
|
||||
r.fieldMap["is_self"] = r.IsSelf
|
||||
|
||||
}
|
||||
|
||||
func (r remoteServer) clone(db *gorm.DB) remoteServer {
|
||||
|
@ -117,6 +124,77 @@ func (r remoteServer) replaceDB(db *gorm.DB) remoteServer {
|
|||
return r
|
||||
}
|
||||
|
||||
type remoteServerBelongsToIcon struct {
|
||||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
}
|
||||
|
||||
func (a remoteServerBelongsToIcon) Where(conds ...field.Expr) *remoteServerBelongsToIcon {
|
||||
if len(conds) == 0 {
|
||||
return &a
|
||||
}
|
||||
|
||||
exprs := make([]clause.Expression, 0, len(conds))
|
||||
for _, cond := range conds {
|
||||
exprs = append(exprs, cond.BeCond().(clause.Expression))
|
||||
}
|
||||
a.db = a.db.Clauses(clause.Where{Exprs: exprs})
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a remoteServerBelongsToIcon) WithContext(ctx context.Context) *remoteServerBelongsToIcon {
|
||||
a.db = a.db.WithContext(ctx)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a remoteServerBelongsToIcon) Session(session *gorm.Session) *remoteServerBelongsToIcon {
|
||||
a.db = a.db.Session(session)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a remoteServerBelongsToIcon) Model(m *models.RemoteServer) *remoteServerBelongsToIconTx {
|
||||
return &remoteServerBelongsToIconTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
type remoteServerBelongsToIconTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a remoteServerBelongsToIconTx) Find() (result *models.MediaMetadata, err error) {
|
||||
return result, a.tx.Find(&result)
|
||||
}
|
||||
|
||||
func (a remoteServerBelongsToIconTx) Append(values ...*models.MediaMetadata) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Append(targetValues...)
|
||||
}
|
||||
|
||||
func (a remoteServerBelongsToIconTx) Replace(values ...*models.MediaMetadata) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Replace(targetValues...)
|
||||
}
|
||||
|
||||
func (a remoteServerBelongsToIconTx) Delete(values ...*models.MediaMetadata) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Delete(targetValues...)
|
||||
}
|
||||
|
||||
func (a remoteServerBelongsToIconTx) Clear() error {
|
||||
return a.tx.Clear()
|
||||
}
|
||||
|
||||
func (a remoteServerBelongsToIconTx) Count() int64 {
|
||||
return a.tx.Count()
|
||||
}
|
||||
|
||||
type remoteServerDo struct{ gen.DO }
|
||||
|
||||
type IRemoteServerDo interface {
|
||||
|
|
|
@ -33,6 +33,141 @@ func newUserAuthMethod(db *gorm.DB, opts ...gen.DOOption) userAuthMethod {
|
|||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("User", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_userAuthMethod.fillFieldMap()
|
||||
|
@ -104,6 +239,70 @@ type userAuthMethodBelongsToUser struct {
|
|||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a userAuthMethodBelongsToUser) Where(conds ...field.Expr) *userAuthMethodBelongsToUser {
|
||||
|
|
|
@ -39,6 +39,141 @@ func newUserInfoField(db *gorm.DB, opts ...gen.DOOption) userInfoField {
|
|||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("User", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_userInfoField.fillFieldMap()
|
||||
|
@ -128,6 +263,70 @@ type userInfoFieldBelongsToUser struct {
|
|||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a userInfoFieldBelongsToUser) Where(conds ...field.Expr) *userInfoFieldBelongsToUser {
|
||||
|
|
|
@ -43,6 +43,141 @@ func newUserRemoteLinks(db *gorm.DB, opts ...gen.DOOption) userRemoteLinks {
|
|||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("User", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_userRemoteLinks.fillFieldMap()
|
||||
|
@ -144,6 +279,70 @@ type userRemoteLinksBelongsToUser struct {
|
|||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a userRemoteLinksBelongsToUser) Where(conds ...field.Expr) *userRemoteLinksBelongsToUser {
|
||||
|
|
|
@ -32,6 +32,141 @@ func newUserToBeing(db *gorm.DB, opts ...gen.DOOption) userToBeing {
|
|||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("User", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_userToBeing.fillFieldMap()
|
||||
|
@ -100,6 +235,70 @@ type userToBeingBelongsToUser struct {
|
|||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a userToBeingBelongsToUser) Where(conds ...field.Expr) *userToBeingBelongsToUser {
|
||||
|
|
660
storage-new/dbgen/user_to_pronouns.gen.go
Normal file
660
storage-new/dbgen/user_to_pronouns.gen.go
Normal file
|
@ -0,0 +1,660 @@
|
|||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package dbgen
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
)
|
||||
|
||||
func newUserToPronoun(db *gorm.DB, opts ...gen.DOOption) userToPronoun {
|
||||
_userToPronoun := userToPronoun{}
|
||||
|
||||
_userToPronoun.userToPronounDo.UseDB(db, opts...)
|
||||
_userToPronoun.userToPronounDo.UseModel(&models.UserToPronoun{})
|
||||
|
||||
tableName := _userToPronoun.userToPronounDo.TableName()
|
||||
_userToPronoun.ALL = field.NewAsterisk(tableName)
|
||||
_userToPronoun.UserId = field.NewString(tableName, "user_id")
|
||||
_userToPronoun.Pronoung = field.NewString(tableName, "pronoung")
|
||||
_userToPronoun.User = userToPronounBelongsToUser{
|
||||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("User", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_userToPronoun.fillFieldMap()
|
||||
|
||||
return _userToPronoun
|
||||
}
|
||||
|
||||
type userToPronoun struct {
|
||||
userToPronounDo
|
||||
|
||||
ALL field.Asterisk
|
||||
UserId field.String
|
||||
Pronoung field.String
|
||||
User userToPronounBelongsToUser
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (u userToPronoun) Table(newTableName string) *userToPronoun {
|
||||
u.userToPronounDo.UseTable(newTableName)
|
||||
return u.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (u userToPronoun) As(alias string) *userToPronoun {
|
||||
u.userToPronounDo.DO = *(u.userToPronounDo.As(alias).(*gen.DO))
|
||||
return u.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (u *userToPronoun) updateTableName(table string) *userToPronoun {
|
||||
u.ALL = field.NewAsterisk(table)
|
||||
u.UserId = field.NewString(table, "user_id")
|
||||
u.Pronoung = field.NewString(table, "pronoung")
|
||||
|
||||
u.fillFieldMap()
|
||||
|
||||
return u
|
||||
}
|
||||
|
||||
func (u *userToPronoun) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := u.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (u *userToPronoun) fillFieldMap() {
|
||||
u.fieldMap = make(map[string]field.Expr, 3)
|
||||
u.fieldMap["user_id"] = u.UserId
|
||||
u.fieldMap["pronoung"] = u.Pronoung
|
||||
|
||||
}
|
||||
|
||||
func (u userToPronoun) clone(db *gorm.DB) userToPronoun {
|
||||
u.userToPronounDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return u
|
||||
}
|
||||
|
||||
func (u userToPronoun) replaceDB(db *gorm.DB) userToPronoun {
|
||||
u.userToPronounDo.ReplaceDB(db)
|
||||
return u
|
||||
}
|
||||
|
||||
type userToPronounBelongsToUser struct {
|
||||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a userToPronounBelongsToUser) Where(conds ...field.Expr) *userToPronounBelongsToUser {
|
||||
if len(conds) == 0 {
|
||||
return &a
|
||||
}
|
||||
|
||||
exprs := make([]clause.Expression, 0, len(conds))
|
||||
for _, cond := range conds {
|
||||
exprs = append(exprs, cond.BeCond().(clause.Expression))
|
||||
}
|
||||
a.db = a.db.Clauses(clause.Where{Exprs: exprs})
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a userToPronounBelongsToUser) WithContext(ctx context.Context) *userToPronounBelongsToUser {
|
||||
a.db = a.db.WithContext(ctx)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a userToPronounBelongsToUser) Session(session *gorm.Session) *userToPronounBelongsToUser {
|
||||
a.db = a.db.Session(session)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a userToPronounBelongsToUser) Model(m *models.UserToPronoun) *userToPronounBelongsToUserTx {
|
||||
return &userToPronounBelongsToUserTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
type userToPronounBelongsToUserTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a userToPronounBelongsToUserTx) Find() (result *models.User, err error) {
|
||||
return result, a.tx.Find(&result)
|
||||
}
|
||||
|
||||
func (a userToPronounBelongsToUserTx) Append(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Append(targetValues...)
|
||||
}
|
||||
|
||||
func (a userToPronounBelongsToUserTx) Replace(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Replace(targetValues...)
|
||||
}
|
||||
|
||||
func (a userToPronounBelongsToUserTx) Delete(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Delete(targetValues...)
|
||||
}
|
||||
|
||||
func (a userToPronounBelongsToUserTx) Clear() error {
|
||||
return a.tx.Clear()
|
||||
}
|
||||
|
||||
func (a userToPronounBelongsToUserTx) Count() int64 {
|
||||
return a.tx.Count()
|
||||
}
|
||||
|
||||
type userToPronounDo struct{ gen.DO }
|
||||
|
||||
type IUserToPronounDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IUserToPronounDo
|
||||
WithContext(ctx context.Context) IUserToPronounDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IUserToPronounDo
|
||||
WriteDB() IUserToPronounDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IUserToPronounDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IUserToPronounDo
|
||||
Not(conds ...gen.Condition) IUserToPronounDo
|
||||
Or(conds ...gen.Condition) IUserToPronounDo
|
||||
Select(conds ...field.Expr) IUserToPronounDo
|
||||
Where(conds ...gen.Condition) IUserToPronounDo
|
||||
Order(conds ...field.Expr) IUserToPronounDo
|
||||
Distinct(cols ...field.Expr) IUserToPronounDo
|
||||
Omit(cols ...field.Expr) IUserToPronounDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IUserToPronounDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IUserToPronounDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IUserToPronounDo
|
||||
Group(cols ...field.Expr) IUserToPronounDo
|
||||
Having(conds ...gen.Condition) IUserToPronounDo
|
||||
Limit(limit int) IUserToPronounDo
|
||||
Offset(offset int) IUserToPronounDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IUserToPronounDo
|
||||
Unscoped() IUserToPronounDo
|
||||
Create(values ...*models.UserToPronoun) error
|
||||
CreateInBatches(values []*models.UserToPronoun, batchSize int) error
|
||||
Save(values ...*models.UserToPronoun) error
|
||||
First() (*models.UserToPronoun, error)
|
||||
Take() (*models.UserToPronoun, error)
|
||||
Last() (*models.UserToPronoun, error)
|
||||
Find() ([]*models.UserToPronoun, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.UserToPronoun, err error)
|
||||
FindInBatches(result *[]*models.UserToPronoun, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*models.UserToPronoun) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IUserToPronounDo
|
||||
Assign(attrs ...field.AssignExpr) IUserToPronounDo
|
||||
Joins(fields ...field.RelationField) IUserToPronounDo
|
||||
Preload(fields ...field.RelationField) IUserToPronounDo
|
||||
FirstOrInit() (*models.UserToPronoun, error)
|
||||
FirstOrCreate() (*models.UserToPronoun, error)
|
||||
FindByPage(offset int, limit int) (result []*models.UserToPronoun, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IUserToPronounDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Debug() IUserToPronounDo {
|
||||
return u.withDO(u.DO.Debug())
|
||||
}
|
||||
|
||||
func (u userToPronounDo) WithContext(ctx context.Context) IUserToPronounDo {
|
||||
return u.withDO(u.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) ReadDB() IUserToPronounDo {
|
||||
return u.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (u userToPronounDo) WriteDB() IUserToPronounDo {
|
||||
return u.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Session(config *gorm.Session) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Session(config))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Clauses(conds ...clause.Expression) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Returning(value interface{}, columns ...string) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Not(conds ...gen.Condition) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Or(conds ...gen.Condition) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Select(conds ...field.Expr) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Where(conds ...gen.Condition) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Order(conds ...field.Expr) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Distinct(cols ...field.Expr) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Omit(cols ...field.Expr) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Join(table schema.Tabler, on ...field.Expr) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) LeftJoin(table schema.Tabler, on ...field.Expr) IUserToPronounDo {
|
||||
return u.withDO(u.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) RightJoin(table schema.Tabler, on ...field.Expr) IUserToPronounDo {
|
||||
return u.withDO(u.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Group(cols ...field.Expr) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Having(conds ...gen.Condition) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Limit(limit int) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Offset(offset int) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Unscoped() IUserToPronounDo {
|
||||
return u.withDO(u.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Create(values ...*models.UserToPronoun) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return u.DO.Create(values)
|
||||
}
|
||||
|
||||
func (u userToPronounDo) CreateInBatches(values []*models.UserToPronoun, batchSize int) error {
|
||||
return u.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (u userToPronounDo) Save(values ...*models.UserToPronoun) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return u.DO.Save(values)
|
||||
}
|
||||
|
||||
func (u userToPronounDo) First() (*models.UserToPronoun, error) {
|
||||
if result, err := u.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.UserToPronoun), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Take() (*models.UserToPronoun, error) {
|
||||
if result, err := u.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.UserToPronoun), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Last() (*models.UserToPronoun, error) {
|
||||
if result, err := u.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.UserToPronoun), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Find() ([]*models.UserToPronoun, error) {
|
||||
result, err := u.DO.Find()
|
||||
return result.([]*models.UserToPronoun), err
|
||||
}
|
||||
|
||||
func (u userToPronounDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.UserToPronoun, err error) {
|
||||
buf := make([]*models.UserToPronoun, 0, batchSize)
|
||||
err = u.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (u userToPronounDo) FindInBatches(result *[]*models.UserToPronoun, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return u.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Attrs(attrs ...field.AssignExpr) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Assign(attrs ...field.AssignExpr) IUserToPronounDo {
|
||||
return u.withDO(u.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Joins(fields ...field.RelationField) IUserToPronounDo {
|
||||
for _, _f := range fields {
|
||||
u = *u.withDO(u.DO.Joins(_f))
|
||||
}
|
||||
return &u
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Preload(fields ...field.RelationField) IUserToPronounDo {
|
||||
for _, _f := range fields {
|
||||
u = *u.withDO(u.DO.Preload(_f))
|
||||
}
|
||||
return &u
|
||||
}
|
||||
|
||||
func (u userToPronounDo) FirstOrInit() (*models.UserToPronoun, error) {
|
||||
if result, err := u.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.UserToPronoun), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (u userToPronounDo) FirstOrCreate() (*models.UserToPronoun, error) {
|
||||
if result, err := u.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.UserToPronoun), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (u userToPronounDo) FindByPage(offset int, limit int) (result []*models.UserToPronoun, count int64, err error) {
|
||||
result, err = u.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = u.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (u userToPronounDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = u.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = u.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Scan(result interface{}) (err error) {
|
||||
return u.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (u userToPronounDo) Delete(models ...*models.UserToPronoun) (result gen.ResultInfo, err error) {
|
||||
return u.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (u *userToPronounDo) withDO(do gen.Dao) *userToPronounDo {
|
||||
u.DO = *do.(*gen.DO)
|
||||
return u
|
||||
}
|
|
@ -32,6 +32,141 @@ func newUserToRole(db *gorm.DB, opts ...gen.DOOption) userToRole {
|
|||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("User", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_userToRole.Role = userToRoleBelongsToRole{
|
||||
|
@ -108,6 +243,70 @@ type userToRoleBelongsToUser struct {
|
|||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a userToRoleBelongsToUser) Where(conds ...field.Expr) *userToRoleBelongsToUser {
|
||||
|
|
|
@ -32,6 +32,141 @@ func newUserToTag(db *gorm.DB, opts ...gen.DOOption) userToTag {
|
|||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("User", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_userToTag.fillFieldMap()
|
||||
|
@ -100,6 +235,70 @@ type userToTagBelongsToUser struct {
|
|||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a userToTagBelongsToUser) Where(conds ...field.Expr) *userToTagBelongsToUser {
|
||||
|
|
|
@ -33,6 +33,141 @@ func newUserToUserRelation(db *gorm.DB, opts ...gen.DOOption) userToUserRelation
|
|||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("User", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_userToUserRelation.TargetUser = userToUserRelationBelongsToTargetUser{
|
||||
|
@ -112,6 +247,70 @@ type userToUserRelationBelongsToUser struct {
|
|||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a userToUserRelationBelongsToUser) Where(conds ...field.Expr) *userToUserRelationBelongsToUser {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -11,6 +11,8 @@ var AllTypes = []any{
|
|||
&Reaction{},
|
||||
&RemoteServer{},
|
||||
&Role{},
|
||||
&AccessToken{},
|
||||
&LoginProcessToken{},
|
||||
&User{},
|
||||
&UserAuthMethod{},
|
||||
&UserToBeing{},
|
||||
|
@ -18,5 +20,6 @@ var AllTypes = []any{
|
|||
&UserToUserRelation{},
|
||||
&UserRemoteLinks{},
|
||||
&UserToTag{},
|
||||
&UserToPronoun{},
|
||||
&UserToRole{},
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
// Media is, at least for Linstrom, always stored on a separate server,
|
||||
// be that the remote server it originated from or an s3 bucket
|
||||
type MediaMetadata struct {
|
||||
ID string `gorm:"primarykey"` // The unique ID of this media file
|
||||
ID string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"` // The unique ID of this media file
|
||||
CreatedAt time.Time // When this entry was created
|
||||
UpdatedAt time.Time // When this entry was last updated
|
||||
// When this entry was deleted (for soft deletions)
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
// - Pings: models.NoteToPing
|
||||
// - Tags: models.NoteTag
|
||||
type Note struct {
|
||||
ID string `gorm:"primarykey"` // Make ID a string (uuid) for other implementations
|
||||
ID string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"` // Make ID a string (uuid) for other implementations
|
||||
CreatedAt time.Time // When this entry was created
|
||||
UpdatedAt time.Time // When this entry was last updated
|
||||
// When this entry was deleted (for soft deletions)
|
||||
|
|
22
storage-new/models/TokenAccess.go
Normal file
22
storage-new/models/TokenAccess.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gen"
|
||||
)
|
||||
|
||||
type AccessToken struct {
|
||||
User User
|
||||
UserId string
|
||||
Token string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"`
|
||||
Name string // Token name will be empty if autogenerated with sucessful login
|
||||
// Every token expires, even if set to "not expire". If set to "not expire", it just expires
|
||||
// at a point in the future this server should never reach
|
||||
ExpiresAt time.Time `gorm:"default:TIMESTAMP WITH TIME ZONE '9999-12-30 23:59:59+00'"`
|
||||
}
|
||||
|
||||
type IAccessToken interface {
|
||||
// INSERT INTO @@table (user_id, token, name, {{if expiresAt != nil}}, )
|
||||
NewToken(user *User, name string, expiresAt *time.Time) (gen.T, error)
|
||||
}
|
12
storage-new/models/TokenLoginProcess.go
Normal file
12
storage-new/models/TokenLoginProcess.go
Normal file
|
@ -0,0 +1,12 @@
|
|||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
// A token used during the login process
|
||||
// Each user may only have at most one login process active at the same time
|
||||
type LoginProcessToken struct {
|
||||
User User
|
||||
UserId string
|
||||
Token string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"`
|
||||
ExpiresAt time.Time
|
||||
}
|
|
@ -30,7 +30,6 @@ type User struct {
|
|||
// identifier for users and other servers, especially when changing the username
|
||||
// (username != display name) might be a future feature
|
||||
// Same also applies for other types that use a UUID as primary key
|
||||
// TODO: Copy the default value and gorm type to those other types as well
|
||||
ID string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"`
|
||||
// Username of the user (eg "max" if the full username is @max@example.com)
|
||||
// Assume unchangable (once set by a user) to be kind to other implementations
|
||||
|
@ -63,9 +62,22 @@ type User struct {
|
|||
Location *string
|
||||
Birthday *time.Time
|
||||
|
||||
// --- And internal account stuff ---
|
||||
// Whether the account got verified and is allowed to be active
|
||||
// For local accounts being active means being allowed to login and perform interactions
|
||||
// For remote users, if an account is not verified, any interactions it sends are discarded
|
||||
Verified bool
|
||||
// 64 byte unique id for passkeys, because UUIDs are 128 bytes and passkey spec says 64 bytes max
|
||||
// In theory, could also slash Id in half, but that would be a lot more calculations than the
|
||||
// saved space is worth
|
||||
PasskeyId []byte
|
||||
|
||||
// ---- "Remote" linked values
|
||||
InfoFields []UserInfoField
|
||||
BeingTypes []UserToBeing
|
||||
Tags []UserToTag
|
||||
Relations []UserToUserRelation
|
||||
Pronouns []UserToPronoun
|
||||
Roles []UserToRole
|
||||
RemoteInfo *UserRemoteLinks
|
||||
AuthMethods []UserAuthMethod
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ package models
|
|||
// For a password, this would be a hash of that password,
|
||||
// totp would be the seed,
|
||||
// and passkey would be the webauthn.Credential, marshalled into json
|
||||
//
|
||||
// Password hashes may only exist at most once per user, the rest 0-m
|
||||
type UserAuthMethod struct {
|
||||
User User
|
||||
UserId string
|
||||
|
|
7
storage-new/models/UserToPronoun.go
Normal file
7
storage-new/models/UserToPronoun.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
package models
|
||||
|
||||
type UserToPronoun struct {
|
||||
User User
|
||||
UserId string
|
||||
Pronoung string
|
||||
}
|
Loading…
Reference in a new issue